Skip to main content

Error Handling


Since light uses micro under the hood, we can use the same techniques for error handling. Any errors that are thrown are automatically caught and handled by light/micro.

In general, it checks the error object for statusCode and a message. You can also use the createError and sendError functions. See more information here.


If you are looking at micro's docs, please note that you do not pass the req or res parameters, because light does it for you. Instead only pass in the third parameter, err.


or with sendError