Skip to content

Better error on mismatched binary operator #396

Open
@sh0rez

Description

@sh0rez

Consider this invalid snippet:

{
  abc: null
} + {
  abc+: {
    foo: "bar"
  }
}

First, surprised me that it is invalid after all, because I assumed I could add object and null (which is represents "nothing", right?).

More importantly, the error message printed by go-jsonnet is pretty useless:

RUNTIME ERROR: Unexpected type null
	During manifestation	

While the one of c++-jsonnet is much better:

RUNTIME ERROR: binary operator + requires matching types, got null and object.
	test.jsonnet:(3:5)-(7:2)	object <anonymous>
	During manifestation

Metadata

Metadata

Assignees

No one assigned

    Labels

    error reportingHow the errors are handled (e.g. stack trace quality)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions