Error catalog
The exported error types and the phases they describe.
Every framework error extends SwagError. Its code, phase, context, and cause help you log a useful report without parsing a message string.
| Export | Typical source |
|---|---|
InitializationError | Local loading or startup failed |
ModuleLoadError | A file could not be loaded |
CommandDefinitionError | A command shape or manifest is invalid |
CommandDeploymentError | Discord application-command sync failed |
CommandExecutionError | A command callback failed |
InteractionResponseError | Reply, deferral, or edit failed |
InteractionAlreadyAcknowledgedError | A second acknowledgement was attempted |
MessageResponseError | Message send, reply, or typing failed |
AutocompleteError | Autocomplete callback or respond() failed |
EventExecutionError | Event callback or filter failed |
PreconditionExecutionError | Guard execution or failure hook failed |
FeatureDefinitionError | Feature file shape or name is invalid |
FeatureExecutionError | A one-time or recurring feature failed |
FeatureCleanupError | A feature cleanup function failed |
ErrorPhase includes initialization, deployment, validation, execution, response, autocomplete, and event. ErrorContext may include a command, subcommand, event, file, feature, invocation kind, deployment scope, or guild ID depending on the error. Check the fields you need rather than assuming every error has every field.
SWAG.create(), startFeatures(), stopFeatures(), and deployment methods can reject directly. Runtime callback failures go to onError (or the logger if no hook is set). A normal precondition denial goes to onPreconditionFailure, not necessarily onError. See Errors and reporting.