Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide machine readable error details for painless compile errors #50993

Closed
stu-elastic opened this issue Jan 14, 2020 · 2 comments
Closed

Provide machine readable error details for painless compile errors #50993

stu-elastic opened this issue Jan 14, 2020 · 2 comments
Assignees
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache Team:Core/Infra Meta label for core/infra team

Comments

@stu-elastic
Copy link
Contributor

Rather than ^---- HERE let's provide a character position.

@stu-elastic stu-elastic self-assigned this Jan 14, 2020
@stu-elastic stu-elastic added the :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache label Jan 14, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Scripting)

stu-elastic added a commit to stu-elastic/elasticsearch that referenced this issue Jan 15, 2020
Add the character position of a scripting error to error responses.

The contents of the `position` field are experimental and subject to
change.  Currently, `offset` refers to the character location where the
error was encounted, `start` and `end` define a range of characters that
contain the error.

eg.
```
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "y = x;",
          "     ^---- HERE"
        ],
        "script": "def x = new ArrayList(); Map y = x;",
        "lang": "painless",
        "position": {
          "offset": 33,
          "start": 29,
          "end": 35
        }
      }
```

Refs: elastic#50993
stu-elastic added a commit that referenced this issue Jan 21, 2020
Add the character position of a scripting error to error responses.

The contents of the `position` field are experimental and subject to
change.  Currently, `offset` refers to the character location where the
error was encountered, `start` and `end` define a range of characters
that contain the error.

eg.
```
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "y = x;",
          "     ^---- HERE"
        ],
        "script": "def x = new ArrayList(); Map y = x;",
        "lang": "painless",
        "position": {
          "offset": 33,
          "start": 29,
          "end": 35
        }
      }
```

Refs: #50993

* Check position only for 7.7+

* 7.7 && decrement before assign

* Use correct experimental tag, update doc test responses, off by one yaml

* Do not duplicate error.caused_by in replacement

* Add position under causedby
stu-elastic added a commit to stu-elastic/elasticsearch that referenced this issue Jan 21, 2020
Add the character position of a scripting error to error responses.

The contents of the `position` field are experimental and subject to
change.  Currently, `offset` refers to the character location where the
error was encountered, `start` and `end` define a range of characters
that contain the error.

eg.
```
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "y = x;",
          "     ^---- HERE"
        ],
        "script": "def x = new ArrayList(); Map y = x;",
        "lang": "painless",
        "position": {
          "offset": 33,
          "start": 29,
          "end": 35
        }
      }
```

Refs: elastic#50993

* Check position only for 7.7+

* 7.7 && decrement before assign

* Use correct experimental tag, update doc test responses, off by one yaml

* Do not duplicate error.caused_by in replacement

* Add position under causedby
stu-elastic added a commit that referenced this issue Jan 21, 2020
Add the character position of a scripting error to error responses.

The contents of the `position` field are experimental and subject to
change.  Currently, `offset` refers to the character location where the
error was encountered, `start` and `end` define a range of characters
that contain the error.

eg.
```
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "y = x;",
          "     ^---- HERE"
        ],
        "script": "def x = new ArrayList(); Map y = x;",
        "lang": "painless",
        "position": {
          "offset": 33,
          "start": 29,
          "end": 35
        }
      }
```

Refs: #50993
@bpintea bpintea added v7.8.0 and removed v7.7.0 labels Mar 25, 2020
@rjernst rjernst added the Team:Core/Infra Meta label for core/infra team label May 4, 2020
@andreidan andreidan added v7.11.0 and removed v7.10.0 labels Oct 7, 2020
@rjernst rjernst added the needs:triage Requires assignment of a team area label label Dec 3, 2020
@stu-elastic
Copy link
Contributor Author

We added the range, further enhancements should be a future issue.

@pugnascotia pugnascotia removed v7.11.0 v8.0.0 needs:triage Requires assignment of a team area label labels Dec 16, 2020
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 Team:Core/Infra Meta label for core/infra team
Projects
None yet
Development

No branches or pull requests

6 participants