Skip to content

Commit eb1d9a0

Browse files
authored
Merge pull request #18 from yuzhiyizhan/main
修改useCatchError文档
2 parents 80e6bcf + fd74c26 commit eb1d9a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/decorator/catch_error.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ outline: deep
1515
`@useCatchError`装饰器,用于捕获函数执行中的异常
1616

1717
```python
18-
@useDecorator.catch_error()
18+
from usepy import useCatchError
19+
20+
21+
@useCatchError()
1922
def exception_demo():
2023
raise Exception('test')
2124

2225

23-
@useDecorator.catch_error(return_val='test')
26+
@useCatchError(return_val='test')
2427
def exception_demo2():
2528
raise Exception('test')
2629

27-
exception_demo() # None
28-
exception_demo2() # 'test'
29-
print("run to here")
3030

31+
print(exception_demo()) # None
32+
print(exception_demo2()) # 'test'
33+
print("run to here")
3134
```

0 commit comments

Comments
 (0)