mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Closes https://github.com/elastic/kibana/issues/32356 This PR fixes two issues. The first there was an issue filed, #32356: - Show non-Boom errors instead of asking users to look at server logs - Also write the error to the server when asking them to look there  *If the function failed for some reason, this is all you'd ever see*  *Errors are shown to the user*  *Code errors bubble up correctly as well* --- The other I didn't bother opening an issue for: - Fixes issue where functions that return `null` produce an error message - `null` is a valid thing to return, it's only `undefined` that causes a problem - This was only a problem for server functions that return `null` (currently, none of them do) - Introduced in #31298 - Discovered when I ran into casting problems (see https://github.com/elastic/kibana/issues/32597)  
This commit is contained in:
parent
5254c40e69
commit
c63da63c64
1 changed files with 5 additions and 1 deletions
|
@ -72,11 +72,15 @@ function runServerFunctions(server) {
|
|||
.catch(err => {
|
||||
if (Boom.isBoom(err)) {
|
||||
return { err, statusCode: err.statusCode, message: err.output.payload };
|
||||
} else if (err instanceof Error) {
|
||||
return { err, statusCode: 500, message: err.message };
|
||||
}
|
||||
|
||||
server.log(['interpreter', 'error'], err);
|
||||
return { err: 'Internal Server Error', statusCode: 500, message: 'See server logs for details.' };
|
||||
});
|
||||
|
||||
if (result == null) {
|
||||
if (typeof result === 'undefined') {
|
||||
const { functionName } = fnCall;
|
||||
return {
|
||||
id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue