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

Add note to error diagnostics when fallibility is due to function arguments #23

Closed
jszwedko opened this issue Sep 16, 2022 · 1 comment · Fixed by #553 or #560
Closed

Add note to error diagnostics when fallibility is due to function arguments #23

jszwedko opened this issue Sep 16, 2022 · 1 comment · Fixed by #553 or #560
Labels
vrl: compiler Changes to the compiler

Comments

@jszwedko
Copy link
Member

Users are frequently confused when a function marked is infallible in the docs is fallible because of the types of its arguments. The error message looks like:

  error[E103]: unhandled fallible assignment
    ┌─ :7:30
    │
  7 │         .splunk_sourcetype = downcase(type)
    │         -------------------- ^^^^^^^^^^^^^^
    │         │                    │
    │         │                    this expression is fallible
    │         │                    update the expression to be infallible
    │         or change this to an infallible assignment:
    │         .splunk_sourcetype, err = downcase(type)
    │
    = see documentation about error handling at https://errors.vrl.dev/#handling
    = learn more about error code 103 at https://errors.vrl.dev/103
    = see language documentation at https://vrl.dev
    = try your code in the VRL REPL, learn more at https://vrl.dev/examples

I think helpful if the diagnostics mentioned the fallibility is due to the type of the function arguments and, perhaps, included a link to https://vector.dev/docs/reference/vrl/expressions/#function-call-characteristics.

@pront
Copy link
Member

pront commented Nov 13, 2023

One more follow-up on this: https://github.com/vectordotdev/vrl/pull/553/files#r1391630156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vrl: compiler Changes to the compiler
Projects
None yet
2 participants