0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00
ghost/core/server/web
Hannah Wolfe 5e931e2e37
Added err.context & err.help to stack traces
- 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
2021-11-24 13:01:06 +00:00
..
admin Fixed error handling for missing admin templates 2021-11-24 12:30:41 +00:00
api Merged our two maintenance middleware into one 2021-11-24 11:27:18 +00:00
members Merged our two maintenance middleware into one 2021-11-24 11:27:18 +00:00
oauth Merged our two maintenance middleware into one 2021-11-24 11:27:18 +00:00
parent Renamed withBackend/withFrotned to backend/frontend 2021-11-22 21:56:32 +13:00
shared Added err.context & err.help to stack traces 2021-11-24 13:01:06 +00:00
index.js
well-known.js Inlined package requires to save boot time and memory 2021-10-22 09:57:59 +02:00