Class: MVCLI::Middleware::ExitStatus
- Inherits:
-
Object
- Object
- MVCLI::Middleware::ExitStatus
- Defined in:
- lib/mvcli/middleware/exit_status.rb
Constant Summary collapse
- EX_OK =
:ok, :success - Successful termination
0- EX__BASE =
:_base - The base value for sysexit codes
64- EX_USAGE =
:usage - The command was used incorrectly, e.g., with the wrong number of arguments, a bad flag, a bad syntax in a parameter, or whatever.
64- EX_DATAERR =
:dataerr, :data_error - The input data was incorrect in some way. This should only be used for user data, not system files.
65- EX_NOINPUT =
:noinput, :input_missing - An input file (not a system file) did not exist or was not readable. This could also include errors like “No message” to a mailer (if it cared to catch it).
66- EX_NOUSER =
:nouser, :no_such_user - The user specified did not exist. This might be used for mail addresses or remote logins.
67- EX_NOHOST =
:nohost, :no_such_host - The host specified did not exist. This is used in mail addresses or network requests.
68- EX_UNAVAILABLE =
:unavailable, :service_unavailable - A service is unavailable. This can occur if a support program or file does not exist. This can also be used as a catchall message when something you wanted to do doesn’t work, but you don’t know why.
69- EX_SOFTWARE =
:software, :software_error - An internal software error has been detected. This should be limited to non-operating system related errors.
70- EX_OSERR =
:oserr, :operating_system_error - An operating system error has been detected. This is intended to be used for such things as “cannot fork”, “cannot create pipe”, or the like. It includes things like getuid returning a user that does not exist in the passwd file.
71- EX_OSFILE =
:osfile, :operating_system_file_error - Some system file (e.g., /etc/passwd, /etc/utmp, etc.) does not exist, cannot be opened, or has some sort of error (e.g., syntax error).
72- EX_CANTCREAT =
:cantcreat, :cant_create_output - A (user specified) output file cannot be created.
73- EX_IOERR =
:ioerr - An error occurred while doing I/O on a file.
74- EX_TEMPFAIL =
:tempfail, :temporary_failure, :try_again - Temporary failure, indicating something that is not really a serious error. In sendmail, this means that a mailer (e.g.) could not create a connection, and the request should be reattempted later.
75- EX_PROTOCOL =
:protocol, :protocol_error - The remote system returned something that was “not possible” during a protocol exchange.
76- EX_NOPERM =
:noperm, :permission_denied - You did not have sufficient permission to perform the operation. This is not intended for file system problems, which should use NOINPUT or CANTCREAT, but rather for higher level permissions.
77- EX_CONFIG =
:config, :config_error - There was an error in a user-specified configuration value.
78
Instance Method Summary collapse
Instance Method Details
#call(command) ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/mvcli/middleware/exit_status.rb', line 82 def call(command) result = yield command result.is_a?(Integer) ? result : EX_OK rescue MVCLI::Validatable::ValidationError return EX_DATAERR rescue MVCLI::Router::RoutingError => e return EX_USAGE rescue Exception => e return EX_SOFTWARE end |