mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
5e931e2e37
- When we handle errors in Ghost, we are supposed to use a pattern of supplying 3 messages: - message: what went wrong - context: details about why how or where the error happened - help: where the user can go to get help with this error - We do this in many places and our JSON error handler and CLI error logging tools are designed to output this extra information - However, stack traces, which start with message as the first line and then output the stack are totally missing this - By injecting the additional messages into the stack once an error has been "ghostified" we should get clearer messages everywhere Notes: - I've additionally injected a "Stack Trace:" line that makes it easier to read the error vs the stack - This code looks a little weird because the lines are inserted backwards, but that allows us to always to the insert at position 1 as per the comment, so we don't have to keep track of whether we already injected something or not |
||
---|---|---|
.. | ||
middleware | ||
index.js | ||
utils.js |