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

Catch null values and function calls #678

Open
philippkahr opened this issue Dec 7, 2023 · 0 comments
Open

Catch null values and function calls #678

philippkahr opened this issue Dec 7, 2023 · 0 comments
Labels
discuss Issue needs discussion

Comments

@philippkahr
Copy link

Based on e.g. elastic/integrations#8670 but when you do:

if: ctx.cool.field.startsWith('abc')

or anythign really that uses a function like startsWith(),contains(),… it won’t work if it is null and you get a painless error along the lines of null does not have function `startsWith()``

Would it be possible to test this? To make sure that this is captured as it should at least look like this:

if: ctx.cool?.field?.startsWith('abc') ?: false

because that surpresses the error at least and the other processors work as intended (hopefully).

Best should be:

if: ctx.cool?.field instanceof String && ctx.cool.field.startsWith('abc')

At least that we can highlight when somebody is using startsWith(), contains() and those thinks, inside the if clause on a processor level to ensure that they don’t break something?

@philippkahr philippkahr added the discuss Issue needs discussion label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Issue needs discussion
Projects
None yet
Development

No branches or pull requests

1 participant