const mixinafBedSheet::ErrProcessor

afBedSheet::ErrProcessor

Implement to define an ErrProcessor.

ErrProcessors process Errs thrown from request handler methods. They typically generate and return err pages to the client. They may also log details, raise alerts and send emails.

ErrProcessors are mapped to a specific Err. When an Err is raised, the processor with the closest matching Err type is called to handle it.

If no matching processor can be found, a default processor is used. You can override the default processor by setting it in ApplicationDefaults:

@Contribute { serviceType=ApplicationDefaults# } 
static Void configureApplicationDefaults(MappedConfig conf) {
  conf[BedSheetConfigIds.defaultErrProcessor] = MyStatusPage()
}

If you contribute an ErrHandler with the type Err then this is effectively a catch all processor (similar to the default processor.)

IOC Configuration

Instances of ErrProcessor should be contributed to the ErrProcessors service. They are added to a MappedConfig whose key should be a Type, a subclass of Err (or a mixin).

For example, in your AppModule class:

@Contribute { serviceType=ErrProcessors# }
static Void contributeErrProcessors(MappedConfig config) {
    config[Err#] = CatchAllErrHandler()
}

@see BedSheetConfigIds.defaultErrProcessor

process

Source

abstract Obj process(Err err)

Returns a response obj for further processing (such as a Text) or true if no more request processing is required.