Class: Analytics::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/ios_analytics_cli/error_handler.rb

Class Method Summary collapse

Class Method Details

.handle(e) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/ios_analytics_cli/error_handler.rb', line 10

def handle(e)
prompt.error(
  case e
  when Errno::ENOENT
    "We could not find a file that we need:\n\n#{e.message}"
  else
    "An error happened. This might help:\n\n#{e.message}"
  end
)
end

.rescuableObject



4
5
6
7
8
# File 'lib/ios_analytics_cli/error_handler.rb', line 4

def rescuable
  yield
rescue StandardError => e
  handle(e)
end