You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E100]: fallible predicate
┌─ :2:4
│
2 │ if log.status > 200 {
│ ^^^^^^^^^^^^^^^^
│ │
│ expression can result in runtime error
│ handle the error case to ensure runtime success
Ok,I think it's vrl thinks the type of log.status is uncertain, so I'm going to use to_int to convert the type of log.status. So I followed the documentation and wrote a second version.
error[E620]: can't abort infallible function
┌─ :2:4
│
2 │ if to_int!(log.status) > 200 {
│ ^^^^^^- remove this abort-instruction
│ │
│ this function can't fail
I'm not sure if I'm missing any content. The documentation says that to_int is failable.
Eventually I got a usable version.
if to_int(log.status) > 200 {
abort
}
Is there a problem I'm overlooking?
The text was updated successfully, but these errors were encountered:
paomian
changed the title
Some confusion about the vrl documentation, I don't know how to briefly describe this issue
Some confusion about the vrl to_int and greater than documentation
Nov 25, 2024
Basically the compiler has different type information for each example you mentioned. This example demonstrates when ! is needed and when it is not based on the type info: example
vector version: timberio/vector:0.42.0-debian
I have this example toml to test
drop_in_abort
But when writing the vrl for transform_nginx_log, I'm a bit confused.
my first version is
but I got error
Ok,I think it's vrl thinks the type of log.status is uncertain, so I'm going to use to_int to convert the type of log.status. So I followed the documentation and wrote a second version.
I got a new error.
I'm not sure if I'm missing any content. The documentation says that
to_int
is failable.Eventually I got a usable version.
Is there a problem I'm overlooking?
The text was updated successfully, but these errors were encountered: