more elegant 'error' implementation