Error Handling
Bu içerik henüz dilinizde mevcut değil.
Error handling is important in any application, especially one which has a long lifetime of running.
Handling errors in command and event modules
To capture errors, enable the error event in sern’s global event manager.
- Dizinsrc/- Dizincommands/- …
 
- Dizinevents/- error.js
 
- index.js
- config.js
- dependencies.d.ts
 
1import { EventType, eventModule } from '@sern/handler'2
3export default eventModule({4    type: EventType.Sern,5    name: 'error',6    execute: (err) => {7        console.log('caught', err)8    }9})If the error handler is not set, sern’s behavior is to crash the application. This respects node.js’s default behavior
