ternary check on errors