Class: Neetob::ExceptionHandler
- Defined in:
- lib/neetob/exception_handler.rb
Constant Summary
Constants inherited from CLI::Base
CLI::Base::NEETO_APPS_LIST_LINK
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
Attributes inherited from CLI::Base
Instance Method Summary collapse
-
#initialize(exception) ⇒ ExceptionHandler
constructor
A new instance of ExceptionHandler.
- #process ⇒ Object
Methods included from Utils
#camel_case_to_slug, #is_upper?, #symbolize_keys
Constructor Details
#initialize(exception) ⇒ ExceptionHandler
Returns a new instance of ExceptionHandler.
9 10 11 12 |
# File 'lib/neetob/exception_handler.rb', line 9 def initialize(exception) super() @exception = exception end |
Instance Attribute Details
#exception ⇒ Object
Returns the value of attribute exception.
7 8 9 |
# File 'lib/neetob/exception_handler.rb', line 7 def exception @exception end |
Instance Method Details
#process ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/neetob/exception_handler.rb', line 14 def process case exception when Thor::RequiredArgumentMissingError ui.error( "#{exception.}."\ " Please use the \"help\" command to check all the required options and try again." ) when Octokit::NotFound ui.error( "#{exception.}."\ " Please check the repositry name, repositry access, API endpoint and try again." ) when Octokit::UnprocessableEntity ui.error( "Failed to complete the given request."\ " Make sure that the given entity is correct and processable") when Octokit::Unauthorized ui.error( "You are unauthorized to make API calls,"\ " because the access token is either revoked or invalid or not set."\ " Use \"neetob github login\" command to update or set the token.") when Octokit::Forbidden ui.error( "You don't have enough permissions to access 'bigbinary' organization."\ " Please grant access to this org while authorizing via the browser.") when Errno::ENOENT ui.error( "#{exception.}."\ " Please check the given path and try again" ) when JSON::ParserError ui.error( "There is a problem in parsing the JSON file."\ " Please check and update the given JSON file." ) when SystemExit ui.error( "Process exit with status code 1" ) else ui.error(exception.) end end |