using fail instead of raise