Debug catch exception

Mauricio Baeza 2019-09-29 21:56:21 -05:00
parent 2f12cbd175
commit 21182483dc
1 changed files with 45 additions and 1 deletions

@ -107,6 +107,50 @@ def call_mri()
![image](uploads/7c02ea9b4c944439af4a149e3c71d499/image.png)
<BR>
## Catch exceptions
* In generally, LibreOffice try show you any error.
```python
def error1():
if True:
app.msgbox('This not work')
return
```
```python
def error2():
r = 1 / 0
return
```
* Sometimes, for difficult errors, you can used.
```python
@app.catch_exception
def test():
r = 1 / 0
return
```
* Show in shell
```
29/09/2019 21:50:51 - ERROR - test
Traceback (most recent call last):
File "/home/mau/.config/libreoffice/4/user/Scripts/python/pythonpath/easymacro.py", line 231, in func
return f(*args, **kwargs)
File "/home/mau/.config/libreoffice/4/user/Scripts/python/mymacros.py", line 12, in test
r = 1 / 0
ZeroDivisionError: division by zero
```
And not, not used this function in production.
<BR>
## Info debug
@ -119,4 +163,4 @@ def info_debug()
return
```
![image](uploads/9fee7144eaf111b32faeab5d7d6333f5/image.png)
![image](uploads/9fee7144eaf111b32faeab5d7d6333f5/image.png)