Library Errors References
ds-express-errors can throw its own errors when the library is configured or used incorrectly.
These errors are separate from application errors handled by the library. They indicate an invalid library configuration, invalid arguments, or incorrect initialization.
Each library error has a unique code that can be used to identify the error.
Currently, library errors are mainly related to configuration and global handler initialization.
Configuration Errors
Errors thrown by setConfig() when the configuration is invalid.
ConfigInvalid
Code: ERR_DS_EXPRESS_ERRORS_CONFIG_INVALID
Thrown when an invalid value or type is passed to setConfig().
Examples include:
customMappersis not an arraydevEnvironmentsis not an arrayneedMappersis not an arrayerrorClassesis not an objectformatErroris not a functioncustomLoggeris not an object
ConfigAlreadySet
Code: ERR_DS_EXPRESS_ERRORS_CONFIG_ALREADY_SET
Thrown when setConfig() is called more than once.
ConfigSettingMissing
Code: ERR_DS_EXPRESS_ERRORS_CONFIG_SETTING_MISSING
Thrown when a required configuration value is empty after being initialized.
Global Handler Errors
Errors related to initGlobalHandlers() and graceful shutdown configuration.
GlobalHandlerInvalid
Code: ERR_DS_EXPRESS_ERRORS_GLOBAL_HANDLER_INVALID
Thrown when an invalid value is provided to initGlobalHandlers().
For example, when onCrash or onShutdown is not an async function, or when closeServer is not a function.
GlobalHandlerAlreadySet
Code: ERR_DS_EXPRESS_ERRORS_GLOBAL_HANDLER_ALREADY_SET
Thrown when initGlobalHandlers() is called more than once.
GlobalHandlerSettingMissing
Code: ERR_DS_EXPRESS_ERRORS_GLOBAL_HANDLER_SETTING_MISSING
Thrown when a required global handler setting is missing.
ds-express-errors