-
-
Notifications
You must be signed in to change notification settings - Fork 2
incendium.exceptions.GatewayError
César Román edited this page Apr 30, 2024
·
2 revisions
-
exceptions.BaseException
-
exceptions.Exception
-
incendium.exceptions.JavaError
- incendium.exceptions.GatewayError
-
incendium.exceptions.JavaError
-
exceptions.Exception
Args:
- message (
str
): The error message. - inner_exception (
Throwable
): The inner Exception. Optional. Defaults toNone
. - cause (
str
): The cause of the Exception. Optional. Defaults toNone
.
See incendium.exceptions
recommendations.
Call from the UI; from a button's actionPerformed code.
from incendium.vision import gui
from incendium.exceptions import GatewayError
try:
# Call some function.
app.some_important_function()
except GatewayError as exc:
gui.error(exc.message, "Error")
And the some_important_function
would look like this:
import traceback
from incendium import constants, exceptions
from java.lang import Exception as JavaException
def some_important_function():
"""Very important function."""
try:
# TODO: Do something very important.
pass
except JavaException as exc:
message = constants.UNEXPECTED_ERROR_CAUSED_BY.format(
exceptions.get_function_name(),
"\n".join(traceback.format_exc().splitlines()),
exc.cause,
)
raise exceptions.GatewayError(message, exc, exc.cause)