Unfortunately we cannot do this on the query level, because then evaluating the same constant at different locations would re-evaluate the constant each time since an input changes.
We could do that by having an Option<Span> argument in the query key that we only set to Some if we are erroring. So basically invoke it once with None, causing no error to be emitted, but an error to be returned, if you get back an error, invoke again with Some(span) and now the query can error inside.
Originally posted by @oli-obk in #104317 (comment)
We could do that by having an
Option<Span>argument in the query key that we only set toSomeif we are erroring. So basically invoke it once withNone, causing no error to be emitted, but an error to be returned, if you get back an error, invoke again withSome(span)and now the query can error inside.Originally posted by @oli-obk in #104317 (comment)