Class: RokuBuilder::ErrorHandler
- Inherits:
-
Object
- Object
- RokuBuilder::ErrorHandler
- Defined in:
- lib/roku_builder/error_handler.rb
Overview
Contains methods to handle errors from different sources.
Class Method Summary collapse
-
.handle_command_codes(command_code:, logger:) ⇒ Object
Handle codes returned from handeling commands devices.
-
.handle_configure_codes(configure_code:, logger:) ⇒ Object
Handle codes returned from configuring.
-
.handle_device_codes(device_code:, logger:) ⇒ Object
Handle codes returned from checking devices.
-
.handle_load_codes(options:, load_code:, logger:) ⇒ Object
Handle codes returned from load_config.
-
.handle_options_codes(options_code:, options:, logger:) ⇒ Object
Handle codes returned from validating options.
Class Method Details
.handle_command_codes(command_code:, logger:) ⇒ Object
Handle codes returned from handeling commands devices
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/roku_builder/error_handler.rb', line 95 def self.handle_command_codes(command_code:, logger:) case command_code when FAILED_SIDELOAD logger.fatal "Failed Sideloading App" abort when FAILED_SIGNING logger.fatal "Failed Signing App" abort when FAILED_DEEPLINKING logger.fatal "Failed Deeplinking To App" abort when FAILED_NAVIGATING logger.fatal "Command not sent" abort when FAILED_SCREENCAPTURE logger.fatal "Failed to Capture Screen" abort end end |
.handle_configure_codes(configure_code:, logger:) ⇒ Object
Handle codes returned from configuring
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/roku_builder/error_handler.rb', line 36 def self.handle_configure_codes(configure_code:, logger:) case configure_code when CONFIG_OVERWRITE logger.fatal 'Config already exists. To create default please remove config first.' abort when SUCCESS logger.info 'Configure successful' abort end end |
.handle_device_codes(device_code:, logger:) ⇒ Object
Handle codes returned from checking devices
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/roku_builder/error_handler.rb', line 79 def self.handle_device_codes(device_code:, logger:) case device_code when CHANGED_DEVICE logger.info "The default device was not online so a secondary device is being used" when BAD_DEVICE logger.fatal "The selected device was not online" abort when NO_DEVICES logger.fatal "No configured devices were found" abort end end |
.handle_load_codes(options:, load_code:, logger:) ⇒ Object
Handle codes returned from load_config
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/roku_builder/error_handler.rb', line 51 def self.handle_load_codes(options:, load_code:, logger:) case load_code when DEPRICATED_CONFIG logger.warn 'Depricated config. See Above' when MISSING_CONFIG logger.fatal "Missing config file: #{options[:config]}" abort when INVALID_CONFIG logger.fatal 'Invalid config. See Above' abort when MISSING_MANIFEST logger.fatal 'Manifest file missing' abort when UNKNOWN_DEVICE logger.fatal "Unkown device id" abort when UNKNOWN_PROJECT logger.fatal "Unknown project id" abort when UNKNOWN_STAGE logger.fatal "Unknown stage" abort end end |
.handle_options_codes(options_code:, options:, logger:) ⇒ Object
Handle codes returned from validating options
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/roku_builder/error_handler.rb', line 8 def self.(options_code:, options:, logger:) case when EXTRA_COMMANDS logger.fatal "Only one command is allowed" abort when NO_COMMANDS logger.fatal "At least one command is required" abort when EXTRA_SOURCES logger.fatal "Only use one of --ref, --working, --current or --stage" abort when NO_SOURCE logger.fatal "Must use at least one of --ref, --working, --current or --stage" abort when BAD_CURRENT logger.fatal "Can only sideload or build 'current' directory" abort when BAD_IN_FILE logger.fatal "Can only supply in file for building" abort when DEPRICATED (options: , logger: logger) end end |