Concepts
Exceptions
Every exception that passes through your code is recorded with where it was raised, the calls it left and where it was handled, and gets a status such as swallowed or uncaught.
An exception is recorded when it passes through your code: where it was raised, the calls it left, where it was handled. Its message is a value and is not recorded without --values; its type and the shape of its arguments are.
$ ormaos exceptions r1:e1
r1:e1 validate.SkuFormatError: swallowed
raised at validate.py:24 in check_sku [r1:c168]
left calls check_sku [r1:c168], check_order [r1:c167]
handled at job.py:57 in sync_orders [r1:c130] and not raised again
message not recorded; args: tuple[1 str]
logs 6 logging records in the call that handled it and below (6 dropped by the level) [r1:l2]
same type, same handler: 6 in all: r1:e1 r1:e2 r1:e3 r1:e4 r1:e5 ...
next: ormaos tree r1:c130 | ormaos logs r1:c130 | ormaos io r1:c130 | ormaos tree r1:c168 | ormaos exceptions r1:e2Status#
| Status | Meaning |
|---|---|
swallowed | it entered an except and was not raised again; "handled at" is the line of that except |
uncaught | it ended the program |
replaced | another exception was raised from its handler |
exit | a SystemExit that ended the program; one that your program catches is swallowed like any other |
ended at await | the StopIteration that hands over the result of an awaited future (see below) |
no handler seen | it left your code and no handler was seen |
ormaos exceptions lists swallowed exceptions first. ormaos show and the summary group them by type, place raised and place handled.
Raised inside a library#
When an exception is raised inside the standard library or an installed package, the recording gives the place where it was raised and the first line of your code where it was seen:
$ ormaos exceptions r1:e1
r1:e1 urllib.error.HTTPError: swallowed
raised at /tmp/ormaos-docs-python/cpython-3.14.4-linux-x86_64-gnu/lib/python3.14/urllib/request.py:611 in HTTPDefaultErrorHandler.http_error_default [r1:c20] (not your code; first seen at app.py:20 in ask)
left calls ask [r1:c20]
handled at app.py:28 in summarize [r1:c19] and not raised again
message not recorded; args: tuple[0]
same type, same handler: 3 in all: r1:e1 r1:e2 r1:e3
next: ormaos tree r1:c19 | ormaos io r1:c19 | ormaos tree r1:c20 | ormaos exceptions r1:e2 | ormaos path r1:e1Taken by the interpreter#
Python raises some exceptions and takes them itself, without an except of your code. The StopIteration that ends a for over an iterator implemented in Python is one; Ormaos counts these apart:
$ ormaos exceptions r1:e1
r1:e1 StopIteration: taken by the interpreter
raised at /tmp/ormaos-docs-python/cpython-3.14.4-linux-x86_64-gnu/lib/python3.14/csv.py:177 in DictReader.__next__ [r1:c1] (not your code; first seen at /tmp/ipykernel_…/1887773198.py:13 in load)
left calls load [r1:c1]
handled at nowhere seen
message not recorded; args: tuple[0]
next: ormaos tree r1:c1When a coroutine awaits a future and the future finishes (await asyncio.gather(...)), Python raises a StopIteration inside the coroutine and takes it itself. Ormaos records each one, counts them apart and groups them by the line of the await (StopIteration ended at await).
Following an exception#
An exception address given to tree, io, logs or path means the call that handled it:
$ ormaos logs r1:e1
r1:e1 sync_orders and the calls below it: 6 logging records (WARNING 6), 6 dropped by the level
6x WARNING order_sync "order %s skipped: %s" dropped by the level at job.py:58 in sync_orders [r1:l2]
next: ormaos logs r1:l2 | ormaos tree r1:c130 | ormaos logs r1:c16What can be imprecise#
- For
except*the handler line is the first clause of thetry. - An exception kept and raised again later (
raise saved) is reported at the line where it was first raised. - Two exceptions of the same type, the second created exactly where the first one just left, can be read as one.