Why does catching the following index-error fail:
let
Source = "abc",
letter_list = Text.ToList(Source),
try_on_index_error = try letter_list{5}
in
try_on_index_error
The try
statement does not return an Error
record. It keeps throwing the error as if no try
was present.
In this case it works as expected, returning an Error
record as a valid result of the query:
let
Source = "abc",
try_another_error = try Source + 1,
Error = try_another_error[Error]
in
Error
https://docs.microsoft.com/en-us/power-query/handlingerrors#catching-an-error-with-try-and-otherwise
https://docs.microsoft.com/en-us/powerquery-m/m-spec-consolidated-grammar#error-handling-expression
try
rather than breaking the query with an "Unexpected error". – Alexis Olsonletter_list = List.Buffer(Text.ToList(Source)),
– Ron Rosenfeldtry letter_list{1}
and here theError
record is returned (of course with[Error][HasError] = false
). – pylo