Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Mar 11, 2020
1 parent c76542f commit 54b5d15
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions x-pack/plugins/painless_lab/server/routes/api/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,13 @@ export function registerExecuteRoute({ router, license }: RouteDependencies) {
body: response,
});
} catch (e) {
// Invalid painless script was submitted
// Return 200 with error object
if (e.body) {
if (isEsError(e)) {
// Assume invalid painless script was submitted
// Return 200 with error object
return res.ok({
body: e.body,
});
}

if (isEsError(e)) {
return res.customError({ statusCode: e.statusCode, body: e });
}
return res.internalError({ body: e });
}
})
Expand Down

0 comments on commit 54b5d15

Please sign in to comment.