Each model should declare its own error page and error data.
The common logging services should be used when appropriate to log error information. As much information should be stored in the free form text of the error message, such as return codes, relevant state data, and input parameters.
Follow these guidelines when possible:
- Set an error handler that points to an error handling function within the model. This setup will catch any exceptions that are not caught by the code. If you are building models that will be used by others, the error code should be built into the model. This will also help you in testing the model.
- Establish common error schemas as returned from services to help.
Also, the Model Container builder lets you specify a model to load when an error occurs. This model could display an error message and perhaps links to other pages.
Parent topic: Placing a model within a container