AutoWrapper
AutoWrapper copied to clipboard
TransactionId (or ErrorId) in the output to support lookup in log files?
In a production environment, when exceptions get thrown, or errors occur, it can be good to hide the complexity of the problem (stack trace, etc) and give a vague response instead. AutoWrapper seems to support this with the IsDebug flag. However, it would be really nice to also provide something like a TransactionId (or ErrorId for errors?) so that API developers can easily isolate and analyze the problem in the log files. Does AutoWrapper currently support a way to do this? It looks like you can define custom response schema, but can that custom schema be automatically returned during an exception - rather than making an explicit throw?
AutoWrapper doesn't support adding TransactionId/ErrorId automatically at this point. However, you can use ErrorCode
parameter of the ApiException
object to pass your own ErrorId.
Not ideal, but that is an option. Is there some way for me to do this in one place, rather than repeating this logic everywhere?
Not at the moment. I'll tag this as feature enhancement for future release. Thank you.
Sounds great. Would love to see a TransactionId baked in for all requests. Really enjoying your library so far. Great job!