Handling Errors
Each API controller method call is wrapped in a HOF (higher-order function) called use
.
This is a middleware function that catches any errors in the controller methods and then passes these to a global error handler. This prevents you from having to use try...catch
in your application.
Errors are handled inside /server.js
When an error is caught, it will be logged to the console and a 500 status message returned to the client along with the error message.
Errors are automatically logged and accessible any time in Mission Control.
Please refer to the error handling section in Gravity Web or Gravity Native to understand how these errors are handled on the client side.
Last updated