Skip to content

Improve painless compile-time exceptions#18711

Merged
rmuir merged 1 commit intoelastic:masterfrom
rmuir:painless_compile_exceptions
Jun 3, 2016
Merged

Improve painless compile-time exceptions#18711
rmuir merged 1 commit intoelastic:masterfrom
rmuir:painless_compile_exceptions

Conversation

@rmuir
Copy link
Copy Markdown
Contributor

@rmuir rmuir commented Jun 2, 2016

Followup of #18600
#18600 only improved painless exceptions for the runtime case. This gives the same format for errors that happen at compile time (lexing, parsing, analysis).

The goals are the same: don't make exception handling complicated to code and tests, don't wrap exceptions with BS ones, use the correct exceptions.

In most cases changes just look like this:

-                throw new IllegalArgumentException(error("Extraneous for loop."));
+                throw createError(new IllegalArgumentException("Extraneous for loop."));

The original exception is returned, but with an artificial stack frame added, which looks just like the runtime case. This allows for more consistency (maybe more code sharing in the future too).

@jdconrad
Copy link
Copy Markdown
Contributor

jdconrad commented Jun 2, 2016

+1. Great change! Thanks for doing this.

@rmuir rmuir merged commit ad118eb into elastic:master Jun 3, 2016
@clintongormley clintongormley added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache and removed :Plugin Lang Painless labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache das awesome >enhancement v5.0.0-alpha4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants