Closed elmigranto closed 7 years ago
@j3k0 should be better now https://github.com/j3k0/ganomede-boilerplate/commit/eec9dfdb313be9cad574aae820c45075ccd7a928
I wonder if we should add stack capturing for GanomedeError intances too, but I don't think we create those and call sendHttpError
on different event loop ticks… yet?.. But I guess it's better to print same stuff twice, than look for the source for even half an hour :)
Great stuff. This GanomedeErrors module could be published on its own on npm (like restify did here with restify-errors https://github.com/restify/errors).
Yes, more stacktrace shouldn't hurt.
sendHttpError()
prints error objects that it recieves, but that's not that useful, since stack points to internal places error was created from. While this is fine forGanomedeError
instances and errors from restify (both of which are explicitly created by us inside callbacks), it's not that useful for stuff likesocket hang up
because theirs stack traces point in unhelpful places (like here https://github.com/j3k0/ganomede-directory/issues/15).So replaces those stacks with
new Error().stack
or something similar.This one is probably worth porting to other places, and not only fixing for future services.