Selectively enable the new error scheme via `X-Garg-Error-Scheme` HTTP header
This commit makes possible to pass an optional X-Garg-Error-Scheme
header in a client request to enable the new error format.
It has to be considered a follow-up of !219 (merged) and it aims to fulfil the vision for #267 (closed).
@fmaniere After this MR will be merged, you will be able to have the backend return the new error scheme by passing the X-Garg-Error-Scheme: new
HTTP header. It's completely opt-in, so if you don't pass anything in your frontend request, you will get the old format:
Whereas, if you pass the header in the request...
This will allow you to start porting the frontend to use the new format without having to rush it (i.e. you can do it incrementally as the server supports both formats).
There will be in the future one final MR that I will land which will further improve the error reporting by removing all those occurrences of panic
and error
in the codebase which would translate in a poor/no error.
Hope it helps!