Post Middleware - Handling errors

Hello guys!

I'm playing around with post middlewares. This is my scenario:

Whenever my API throws an error such as database error or api call error I want to persist that event in a table which has a column that stores the error message.

When I use the the "Run & Debug" feature inside Xano, the middleware works as expected and I am able to get an exception status and the error message from the API to save it into the the database.

Calling the API using "Run & Debug" option.

Middleware request log:

When I test or call the api from Postman with a request that will throw an error, the post middleware is executed as expected but I got an ok status without an error message.

Testing with Postman:

Middleware Request Log History:

Middleware implementation:

Any thoughts or ideas what is happening here? I might need to do additional configurations or something?

1
3 replies