Skip to content

Commit

Permalink
update document
Browse files Browse the repository at this point in the history
  • Loading branch information
cocolato committed Apr 4, 2024
1 parent 91ee34a commit 5d3bb36
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def outer():

### Save the exception traceback.

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`.
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`.

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

#### Enable global exception catching:
```python
from pydumpling import catch_any_exception

catch_any_exception()

def inner():
a = 1
b = "2"
c = a + b # noqa: F841


def outer():
inner()

if __name__ == "__main__":
outer()

```

## TODO
- []
22 changes: 21 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def outer():


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

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

#### 开启全局异常捕获:
```python
from pydumpling import catch_any_exception

catch_any_exception()

def inner():
a = 1
b = "2"
c = a + b # noqa: F841


def outer():
inner()

if __name__ == "__main__":
outer()

```

## TODO
- []

0 comments on commit 5d3bb36

Please sign in to comment.