I am learning Ruby and encountered the fail keyword. What does it mean?
fail
if password.length < 8 fail \"Password too short\" end unless use
Rubocop says about usage of both words;
'Use fail instead of raise to signal exceptions.' 'Use raise instead of fail to rethrow exceptions.'
'Use fail instead of raise to signal exceptions.'
raise
'Use raise instead of fail to rethrow exceptions.'
Here is an example.
def sample fail 'something wrong' unless success? rescue => e logger.error e raise end