Framework: packages: error - x684867/nemesis_server GitHub Wiki
This package creates a centralized error handling mechanism for the framework, including
error management and error reporting. Each package consuming this error handler service
can provide its own localized and package-specific error strings, extending the root.error
object created by this package so that packages are kept light and free of expensive load
time binding.
screen
types
Filename | Description |
---|---|
config.json | Configuration file (reserved for future use) |
errors-[LOCALIZED LANGUAGE].json | Localized error strings file |
messages-[LOCALIZED LANGUAGE].json | Localized general messages file |
main.js | Main package executable, containing activeJSON code |
Fully Qualified Method Name | Arguments | Description |
---|---|---|
error.raise(errorJSON,detail) |
errorJSON:standardized error JSON object detail:(optional) string which can be reported with the error |
This method raises an error using a standard JSON object. The object will specify the nature of the error, its severity, whether it is fatal and even may provide an error_hanlding function to execute in hopes of resolving the error. |
error.warn(message) | message:informational string to be reported only | The warn() method is intended as a non-fatal, warn-only method intended for logging errors that warrant significant attention but do not threaten the stability of the system. |
-
When calling raise(), the user will pass a standardized errorJSON object. This JSON object defines the error code, type and text (message to be presented in logs or on stdout). While the user can pass a custom errorJSON object, this is discouraged.
-
errorJSON objects are defined for each package in their localized error.$LANG.json files so that specific text can be localized with least administrative effort. This central definition of errorJSON objects allows the software to abstract itself from the specific error messages.
errorJSON formaterror.definition.object.tree:{ "code":<number>, "type":<string>, "text":<string> }
ErrorJSON Type Description "fatal" Generates a fatal error that will stop the entire system "warn" Generates a warning log message and stack trace. "info" Generates an informational error message in logging.
Tool Name | Arguments | Description |
---|---|---|
inspect_errors | error_filename | This tool will validate the json format of a localized error message file. |