[erlang-questions] Fail politely, fail noisily

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Aug 30 16:52:53 CEST 2012


On Aug 29, 2012, at 9:47 AM, Thomas Elsgaard <thomas.elsgaard@REDACTED> wrote:

> Hi Joe
> 
> There is also PHK's concept of "guru meditation" in the varnish http accelerator..
> 
> http://www.version2.dk/blog/guru-meditation-9738
> 
> Basically the idea is: the user cannot do anything about the error, so let it fail, but provide the transaction Id (xid) so the admin can can troubleshoot...

I did this in erlang. It is very easy. When the web server crashes on the message, you grab Trace = erlang:get_stacktrace(), and Now = erlang:now(). Then you generate a unique token: crypto:sha(term_to_binary({Trace, Now})) and you put that token to the user as well as in the crash log of the server. 

Now any bug reported with a proper token just requires a grep on the logs to find the exact error the user had.

I think it took me 1-2 hours to write and test.


More information about the erlang-questions mailing list