Exceptions mapping sysexits.h.

They are likely to be caught by void run(), for example:

 "The ultimate exception handler."
 suppressWarnings("expressionTypeNothing")
 shared void run() {
     try {
         main();
     } catch (ConfigurationError e) {
         process.writeErrorLine(e.message);
         process.exit(e.exit_code);
     }
 }

Exceptions mapping sysexits.h are named with postfix Error, and extends Exception.

You can extends them to represent more concrete exceptions. For example, this module also provides NotImplementedException, which is defined as

 shared class NotImplementedException(String message)
         extends InternalSoftwareError(message) {}

You can implement your own exception with customize exit_code, which extends abstract class SystexitsException. For example:

 "When following redirects, hit the maximum amount."
 shared class TooManyRedirects(String message) extends SysexitsException(message) {
     "The exit code is borrowed from curl."
     shared actual Integer exit_code 47;
 }
By: Jakukyo Friel
License: 0BSD
Packages
io.github.weakish.sysexits

Maps sysexits.h to Ceylon exceptions, except EX_OK.

Maps sysexits.h to Ceylon exceptions, except EX_OK.

All exceptions extend SysexitsException.

#define EX_USAGE        64      /* command line usage error */
#define EX_DATAERR      65      /* data format error */
#define EX_NOINPUT      66      /* cannot open input */
#define EX_NOUSER       67      /* addressee unknown */
#define EX_NOHOST       68      /* host name unknown */
#define EX_UNAVAILABLE  69      /* service unavailable */
#define EX_SOFTWARE     70      /* internal software error */
#define EX_OSERR        71      /* system error (e.g., can't fork) */
#define EX_OSFILE       72      /* critical OS file missing */
#define EX_CANTCREAT    73      /* can't create (user) output file */
#define EX_IOERR        74      /* input/output error */
#define EX_TEMPFAIL     75      /* temp failure; user is invited to retry */
#define EX_PROTOCOL     76      /* remote error in protocol */
#define EX_NOPERM       77      /* permission denied */
#define EX_CONFIG       78      /* configuration error */
Exceptions
CanNotCreateFileErrorshared CanNotCreateFileError

Can't create (user) output file.

CommandLineUsageErrorshared CommandLineUsageError

Command line usage error, e.g. missing argument for option.

ConfigurationErrorshared ConfigurationError

Wrong configuration.

DataFormatErrorshared DataFormatError

Data format error, e.g. passing a input file with wrong type.

IOErrorshared IOError

Input/output error.

InternalSoftwareErrorshared InternalSoftwareError

Internal software error.

NoHostErrorshared NoHostError

Host name unknown.

NoInputErrorshared NoInputError

Cannot open input.

NoPermissionErrorshared NoPermissionError

permission denied.

NoUserErrorshared NoUserError

Addressee unknown.

NotImplementedExceptionshared NotImplementedException

Similar to UnsupportedOperationException in Java.

NotImplementedYetExceptionshared NotImplementedYetException

Features will be implemented in future.

OSFileErrorshared OSFileError

Critical OS file missing.

RemoteErrorshared RemoteError

Remote error.

ServiceUnavailableErrorshared ServiceUnavailableError

Service unavailable.

SysexitsExceptionshared abstract SysexitsException

Super classes of all sysexits exceptions.

SystemErrorshared SystemError

Low level system error, e.g. jvm and js runtime error or os error.

TempFailureErrorshared TempFailureError

Temp failure; user is invited to retry.