feat(web/bubblegum): report some errors to the user via HTTP
We can actually catch some errors that may be generated in bubblegum applications where we can report them to the user in a way that doesn't require curl -vv: * Type errors in the status argument: By removing yants completely we not only (presumably) gain some performance, but also the ability to return an internal server error on an unexpected type instead of throwing. * User generated evaluation errors: by using builtins.tryEval we can catch throws and asserts the user inserted when generating the body and report to the user that something went wrong. To do: also support for the headers. Change-Id: I8363b9825c6c730e624eb8016a5482d63cbc1890 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2849 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
cbd6f5bbae
commit
1c0f89f4ca
2 changed files with 51 additions and 34 deletions
|
|
@ -33,6 +33,18 @@ let
|
|||
No coffee, I'm afraid
|
||||
'';
|
||||
};
|
||||
"/type-error" = {
|
||||
status = 666;
|
||||
title = "bad usage";
|
||||
content = ''
|
||||
Never gonna see this.
|
||||
'';
|
||||
};
|
||||
"/eval-error" = {
|
||||
status = "OK";
|
||||
title = "evaluation error";
|
||||
content = builtins.throw "lol";
|
||||
};
|
||||
};
|
||||
|
||||
notFound = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue