Use Object#try instead of ternary hack