Skip to content

Commit 5d3bb36

Browse files
committed
update document
1 parent 91ee34a commit 5d3bb36

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def outer():
5353

5454
### Save the exception traceback.
5555

56-
In the code, find the place where we need to do the `try ... except ...` and use `save_dumpling()`. When we save the dump file, it will default to `${exception filename}:${error lineno}.dump`.
56+
In the code, find the place where we need to do the `try ... except ...` and use `save_dumpling()`. When we save the dump file, it will default to `${exception filename}-${error lineno}.dump`.
5757

5858
```python
5959
from pydumpling import save_dumping
@@ -160,5 +160,25 @@ It will open the debugger on port 4444, then we can access pdb using telnet、ne
160160
`nc 127.0.0.1 4444`
161161
![alt text](static/rpdb.png)
162162

163+
#### Enable global exception catching:
164+
```python
165+
from pydumpling import catch_any_exception
166+
167+
catch_any_exception()
168+
169+
def inner():
170+
a = 1
171+
b = "2"
172+
c = a + b # noqa: F841
173+
174+
175+
def outer():
176+
inner()
177+
178+
if __name__ == "__main__":
179+
outer()
180+
181+
```
182+
163183
## TODO
164184
- []

README_zh.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def outer():
4848

4949

5050
### 在异常发生时进行异常堆栈的保存
51-
在异常捕获的处理代码中使用`save_dumpling()`. 如果不指定文件名,默认使用:`${exception file}:${line number of the exception}.dump`.
51+
在异常捕获的处理代码中使用`save_dumpling()`. 如果不指定文件名,默认使用:`${exception file}-${line number of the exception}.dump`.
5252

5353
```python
5454
from pydumpling import save_dumping
@@ -156,5 +156,25 @@ TypeError: unsupported operand type(s) for +: 'int' and 'str'
156156
`nc 127.0.0.1 4444`
157157
![alt text](static/rpdb.png)
158158

159+
#### 开启全局异常捕获:
160+
```python
161+
from pydumpling import catch_any_exception
162+
163+
catch_any_exception()
164+
165+
def inner():
166+
a = 1
167+
b = "2"
168+
c = a + b # noqa: F841
169+
170+
171+
def outer():
172+
inner()
173+
174+
if __name__ == "__main__":
175+
outer()
176+
177+
```
178+
159179
## TODO
160180
- []

0 commit comments

Comments
 (0)