8.1.0 Try function in expression not returning fallback on error


Below, view.params.icon.path doesn’t exist and I want to return false if this is the case. I tried using the try function, but it’s returning bad_stale instead of false.


I’ll use isGood instead (probably should use that anyway)

Is this fixed in 8.1.2?

From Dev:
This is not a bug - it is expected behavior.
Good, Uncertain, and Bad qualities are all passed through as non-error or non-exception values; only qualities which fall under Error result in an “exception” state and therefore return the failover value.

So @nminchin is correct in that the property should be verified as isGood because that is more correct.

Thanks for the clarification, @cmallonee. I can see where you’re coming from, it’s just that with the failover the code is so much more efficient.


…is nice because you only enter the path once, but unfortunately yields Bad_NotFound, while


…just seems a bit repetitious to me.

Wouldn’t Bad_NotFound be somewhat synonymous with an error?

The absence of something does not mean there’s an error. Perspective properties which do not persist fall into this category.

The following cherry-picked expression references a key which is not Persistent.

try({this.custom.myKey}, false)

When the property is in place, the expression reads the property and returns the value. Now we know that the fallback in this situation will never be used because we’ll pass-through the Bad_Stale quality, but the point is that the lack of a property does not mean there is an error or exception - only that the property is not yet in place.

And I’m not saying there isn’t a valid gripe about having to check the quality of something before returning it, but this isn’t new behavior. Also, Expression Transforms can help reduce this a bit.

1 Like