thomas4019 / expressa

API creation middleware with an admin interface
MIT License
439 stars 27 forks source link

Log error message in request log #121

Closed kane-mason closed 3 years ago

kane-mason commented 4 years ago

Since expressa wraps all errors and appends a message. It should be possible to always log the message too to the request_log?

I think it would be useful if you exposed some of the expressa utils to the consumer such ApiError so that the consumer can throw errors in the same way expressa does and they get logged consistenly.

Other useful utils to expose to consumer include generateDocumentId - if you need to create records and want to ensure same uuid mechanism as expressa createSecureRandomId doLogin - for custom (like social) login routing

thomas4019 commented 4 years ago

I totally agree that these things should be exported as that does seem useful. With regard to logging the message, I think that's a great idea too. Usually I think it's best not to log the response, but for error messages I think that would be very helpful.

thomas4019 commented 3 years ago

Fixed in 0.5.26

kane-mason commented 3 years ago

This seems to have stopped working!

kane-mason commented 3 years ago

Ok it seems the message is being logged, but is not displayed in the admin panel

thomas4019 commented 3 years ago

Good catch! I just fixed this in version 1.0.1. Let me know if you see any issues.