err Man Page¶
Name¶
err
- Gufo Err reporting tool.
Synopsys¶
usage: err [-h] [-p PREFIX] {version,list,view,clear} ...
positional arguments:
{version,list,view,clear}
version Show Gufo Err version
list Show the list of the registered errors
view View error report
clear Remove error info
options:
-h, --help show this help message and exit
-p PREFIX, --prefix PREFIX
JSON directory path
Description¶
err
manipulates with the error information, collected by
ErrorInfoMiddleware.
The following commands are supported:
version
: Display Gufo Err version and exit.list
: Show terse list of collected error reports.-
view
: View one or more error details. Dumped format may be set with-f
option: -
terse
(default): Terse format similar to standart python's tracebacks. -
extend
: Extended format with code surroundings and stack variables dump. -
clear
: Remove on or more error reports.
Environment¶
GUFO_ERR_PREFIX
: Default value to--prefix
options. Points to the directory where error reports are stored.
Exit Status¶
Error Fingerprint Expressions¶
Fingerprint expressions can be resolved to zero or more fingerprints
in list
, view
, and clear
subcommands.
Following types of expressions are supported:
<UUID>
, like '0dc69dd9-85f9-5491-bc06-7a493e708738': resolves to single fingerprint.all
: Resolves to all registered errors.*
: Same asall
.
Examples¶
Generating Reports¶
Enable ErrorInfoMiddleware in your code and point to the designated directory to store serialized ErrorInfo files. Add to you code:
Ensure your process has permission to write to the designated directory
(/var/err/
in our example).
Gufo Err Setup¶
Set up GUFO_ERR_PREFIX
environment variable in your shell
to avoid a need to use --prefix
option all the time.
Show Version¶
Output:
Show List of Errors¶
Output:
Fingreprint Exception Service Time Place
------------------------------------ -------------------- ----------------------------- ------------------------------ --------------------------------------------------
0dc69dd9-85f9-5491-bc06-7a493e708738 NameError: foobar fmt-gz 2023-09-01T07:54:59.690078 /workspaces/gufo_err/tests/test_cli.py:57
30dae827-0264-549a-b96f-a9b0298341b2 NotImplementedError fmt-xz 2023-09-01T07:54:59.690078 /workspaces/gufo_err/tests/test_cli.py:57
4d2895ed-519d-508e-9ab9-ecc30c65b7cf ValueError fmt-None 2023-09-01T07:54:59.690078 /workspaces/gufo_err/tests/test_cli.py:57
d6ee6183-170c-5c5f-8645-f0e1506f433e TypeError fmt-bz2 2023-09-01T07:54:59.690078 /workspaces/gufo_err/tests/test_cli.py:57
Show List of Particular Errors¶
Where <fingerprintX>
is an Fingerprint Expression.
Output:
Fingreprint Exception Service Time Place
------------------------------------ -------------------- ----------------------------- ------------------------------ --------------------------------------------------
0dc69dd9-85f9-5491-bc06-7a493e708738 NameError: foobar fmt-gz 2023-09-01T07:54:59.690078 /workspaces/gufo_err/tests/test_cli.py:57
4d2895ed-519d-508e-9ab9-ecc30c65b7cf ValueError fmt-None 2023-09-01T07:54:59.690078 /workspaces/gufo_err/tests/test_cli.py:57
Show Error Detail¶
Where <fingerprint>
is an Fingerprint Expression.
Output:
Error: be8ccd86-3661-434c-8569-40dd65d9860a
Traceback (most resent call last):
File "/app/tests/test_frames.py", line 174, in test_iter_frames
entry()
^^^^^^^
File "/app/tests/sample/trace.py", line 15, in entry
to_oops()
^^^^^^^^^
File "/app/tests/sample/trace.py", line 9, in to_oops
oops()
^^^^^^
File "/app/tests/sample/trace.py", line 3, in oops
raise RuntimeError(msg)
^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: oops
Show Multiple Error Details¶
Where<fingerprintX>
is an Fingerprint Expression.
Show Terse Version of Error Detail¶
Where<fingerprint>
is an Fingerprint Expression.
Output:
Error: be8ccd86-3661-434c-8569-40dd65d9860a
Traceback (most resent call last):
File "/app/tests/test_frames.py", line 174, in test_iter_frames
entry()
^^^^^^^
File "/app/tests/sample/trace.py", line 15, in entry
to_oops()
^^^^^^^^^
File "/app/tests/sample/trace.py", line 9, in to_oops
oops()
^^^^^^
File "/app/tests/sample/trace.py", line 3, in oops
raise RuntimeError(msg)
^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: oops
Show Extended Version of Error Detail¶
Where <fingerprint>
is an Fingerprint Expression.
Error: be8ccd86-3661-434c-8569-40dd65d9860a
RuntimeError: oops
Traceback (most resent call last):
-------------------------------------------------------------------------------
File: /app/tests/test_frames.py (line 174)
167 ),
168 ]
169
170
171 def test_iter_frames():
172 """Call the function which raises an exception."""
173 try:
174 ==> entry()
^^^^^^^
175 msg = "No trace"
176 raise AssertionError(msg)
177 except RuntimeError:
178 frames = list(iter_frames(exc_traceback()))
179 assert frames == SAMPLE_FRAMES
-------------------------------------------------------------------------------
File: /app/tests/sample/trace.py (line 15)
8 x += 1
9 oops()
10
11
12 def entry():
13 s = 2
14 s += 1
15 ==> to_oops()
^^^^^^^^^
Locals:
s = 3
-------------------------------------------------------------------------------
File: /app/tests/sample/trace.py (line 9)
2 msg = "oops"
3 raise RuntimeError(msg)
4
5
6 def to_oops():
7 x = 1
8 x += 1
9 ==> oops()
^^^^^^
10
11
12 def entry():
13 s = 2
14 s += 1
15 to_oops()
Locals:
x = 2
-------------------------------------------------------------------------------
File: /app/tests/sample/trace.py (line 3)
1 def oops():
2 msg = "oops"
3 ==> raise RuntimeError(msg)
^^^^^^^^^^^^^^^^^^^^^^^
4
5
6 def to_oops():
7 x = 1
8 x += 1
9 oops()
10
Locals:
msg = 'oops'
-------------------------------------------------------------------------------
Clearing Single Error¶
Where<fingerprint>
is an Fingerprint Expression.
Clearing Multiple Errors¶
Where<fingerprintX>
is an Fingerprint Expression.