1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-11 20:58:27 +03:00
Zbigniew Jędrzejewski-Szmek 8a753717f8 tools/elf2efi: rework exception messages
RuntimeError is documented as "Unspecified run-time error". It doesn't make
much sense for Python. (It originated in Java, where exceptions that can be
thrown by a function are declared in the function signature. All code calling
such a function must either explicitly catch all possible exception types, or
allow them to propagate by listing them in its own exception type list. This is
nice in theory, but in practice very annoying. Especially during development,
when the list of possible exception types is not finalized, we would end up
adding and removing exceptions to functions signatures all the time. Also for
code which is designed to call functions recursively, we would soon end up with
all functions declaring all possible exception types… To avoid this, people
would quite often do fake handling with a block that either prints and ignores
an exception, or has just a comment like "fix me later", or even nothing. This
often lead to people forgetting to adjust this later on and production code
containing such constructs. An escape hatch was opened with RuntimeException and
its subclasses, which do not need to be pre-declared. Various memory-related
exceptions were added as subclasses of RuntimeException. But later on, people
starting using this to not to have to declare all exception types everywhere.)

In Python, exceptions do no have to be pre-declared, and for code which just
encounters a failure, we should raise a specific exception type. The catch-all
class for unexpected input is ValueError.

For https://github.com/systemd/systemd/issues/31637:
BadSectionError: Section '.data' @0x28000 overlaps previous section @0x28000+0x300=@0x28300

Also, exception strings should not contain trailing periods, because they are
often embedded in sentences.
2024-03-14 11:08:41 +01:00
..
2023-11-01 14:07:54 +00:00
2024-01-23 16:27:50 +01:00
2023-03-10 11:41:08 +01:00
2023-08-10 18:13:29 +02:00
2023-12-25 10:40:40 +01:00
2023-08-23 14:57:49 +02:00
2023-11-15 15:21:26 +01:00
2023-08-10 18:13:29 +02:00