exceptions4c header file More...
#include <stdlib.h>
#include <setjmp.h>
Data Structures | |
struct | Exception |
Represents an exception in the exception handling system. More... | |
struct | SignalMapping |
Represents a map between a signal and an exception. More... | |
struct | ExceptionFrame |
Represents a frame inside an exception context. More... | |
struct | ExceptionContext |
Represents the exception context of the program. More... | |
Defines | |
Exception handling keywords | |
#define | try |
Introduces a block of code aware of exceptions. | |
#define | catch(_exception_) |
Introduces a block of code capable of handling a specific kind of exceptions. | |
#define | finally |
Introduces a block of code responsible for cleaning up the previous try block. | |
#define | throw(_exception_) |
Signals an exceptional situation represented by an exception object. | |
Convenience macros for acessing exception-related information | |
#define | E4C_CONTEXT getExceptionContext() |
Accesses the current exception context of the program (or current thread). | |
#define | EC4_FRAME (E4C_CONTEXT->currentFrame) |
Accesses the current frame of the exception context. | |
#define | EXCEPTION (EC4_FRAME->exception) |
Accesses the current exception being thrown from the current exception frame. | |
#define | EC4_ERRNO (EC4_FRAME->errorNumber) |
Accesses the error number of the current exception frame. | |
#define | EC4_FILE (EC4_FRAME->srcFile) |
Accesses the error file of the current exception frame. | |
#define | EC4_LINE (EC4_FRAME->srcLine) |
Accesses the error line of the current exception frame. | |
#define | EC4_STATUS_THROWN (EC4_FRAME->thrown) |
Accesses the thrown flag of the current exception frame. | |
#define | EC4_STATUS_UNCAUGHT (EC4_FRAME->uncaught) |
Accesses the uncaught flag of the current exception frame. | |
#define | EC4_SUCCEED (!EC4_STATUS_THROWN) |
Checks whether the current exception frame did complete without an error. | |
#define | EC4_RECOVERED (EC4_STATUS_THROWN && !EC4_STATUS_UNCAUGHT) |
Checks whether the current exception frame did fail and then did recover of the error. | |
#define | EC4_FAILED (EC4_STATUS_THROWN && EC4_STATUS_UNCAUGHT) |
Checks whether the current exception frame did fail and did not recover of the error. | |
Dispose pattern keywords | |
#define | with(_resource_, _dispose_) |
Opens a block of code with automatic disposal of a resource. | |
#define | use |
Closes a block of code with automatic disposal of a resource. | |
#define | using(_type_, _resource_, _args_) |
Introduces a block of code with automatic acquisition and disposal of a resource. | |
Convenience macros for acquiring and disposing resources | |
#define | acquireMemory malloc |
Binds the acquisition of memory to the standard function malloc . | |
#define | disposeMemory(_buffer_, _failure_, _context_) free(_buffer_) |
Binds the disposal of memory to the standard function malloc . | |
#define | usingMemory(_buffer_, _bytes_) |
Introduces a block of code with automatic acquisition and disposal of a memory buffer. | |
#define | acquireFile fopen |
Binds the acquisition of file to the standard function fopen . | |
#define | disposeFile(_file_, _failure_, _context_) fclose(_file_) |
Binds the disposal of memory to the standard function fclose . | |
#define | usingFile(_file_, _path_, _mode_) |
Introduces a block of code with automatic acquisition and disposal of a file stream. | |
#define | usingIf(_type_, _resource_, _args_, _cond_, _exception_) |
Introduces a block of code with automatic disposal of a resource and acquisition, under certain condition. | |
#define | usingIfNotNull(_type_, _resource_, _args_, _exception_) |
Introduces a block of code with automatic disposal of a resource and acquisition, preventing null pointers. | |
Other convenience macros | |
These macros let you represent and define Exception and SignalMapping literals and variables. | |
#define | DEFINE_EXCEPTION(_name_, _description_, _super_) |
Defines a new, const exception. | |
#define | SIGNAL_MAPPING(_signalNumber_, _exception_) |
Represents a mapping literal. | |
Typedefs | |
typedef void(* | UncaughtHandler )(Exception exception, const char *srcFile, int srcLine, int errorNumber) |
This is the signature of a function which will be executed in the event of an uncaught exception. | |
Enumerations | |
enum | e4c_Stage { e4c_begin, e4c_acquire, e4c_try, e4c_dispose, e4c_catch, e4c_finalize, e4c_end } |
Represents the current execution status of an exception frame. More... | |
Functions | |
void | beginExceptionContext (unsigned char handleSignals, UncaughtHandler uncaughtHandler) |
Opens an exception context. | |
ExceptionContext * | getExceptionContext () |
Retrieves the current exception context of the program (or current thread). | |
void | endExceptionContext () |
Closes the current exception context. | |
void | setSignalHandlers (const SignalMapping *mapping, int mappings) |
Sets up the signal handling system. | |
void | initializeExceptionContext (ExceptionContext *context) |
Initializes new exception context. | |
const Exception | newException (const char *name, const char *description, const Exception *super) |
Creates a new exception. | |
void | dumpException (Exception exception, const char *srcFile, int srcLine, int errorNumber) |
Prints a fatal error message regarding the specified exception. | |
void | printExceptionHierarchy (Exception exception) |
Prints an exception's hierarchy graph. | |
Variables | |
Predefined exceptions | |
Built-in exceptions represent usual error conditions that might occur during the course of any program. They are organized into a pseudo-hierarchy, being | |
const Exception | INVALID_EXCEPTION |
This represents an invalid exception. | |
const Exception | RuntimeException |
This is the root of the exception pseudo-hierarchy. | |
const Exception | NotEnoughMemoryException |
This exception is thrown when the system runs out of memory. | |
const Exception | NullPointerException |
This exception is thrown when an unexpected null pointer is found. | |
const Exception | FileOpenException |
This exception is thrown when a file cannot be opened. | |
const Exception | SignalException |
This exception is the common supertype of all signal exceptions. | |
const Exception | SignalAlarmException |
This exception is thrown when a time limit has elapsed. | |
const Exception | SignalChildException |
This exception is thrown when a child process terminates. | |
const Exception | SignalTrapException |
This exception is thrown when a condition arises that a debugger has requested to be informed of. | |
const Exception | ErrorSignalException |
This exception is the common supertype of all error signal exceptions. | |
const Exception | IllegalInstructionException |
This exception is thrown when the process attempts to execute an illegal instruction. | |
const Exception | ArithmeticException |
This exception is thrown when the process performs an erroneous arithmetic operation. | |
const Exception | BadPointerException |
This exception is thrown when the process tries to dereference an invalid pointer. | |
const Exception | BrokenPipeException |
This exception is thrown when the process attempts to write to a broken pipe. | |
const Exception | ControlSignalException |
This exception is the common supertype of all control signal exceptions. | |
const Exception | StopException |
This exception is thrown to stop the process for later resumption. | |
const Exception | KillException |
This exception is thrown to terminate the process immediately. | |
const Exception | HangUpException |
This exception is thrown when the process' terminal is closed. | |
const Exception | TerminationException |
This exception is thrown to request the termination of the process. | |
const Exception | AbortException |
This exception is thrown to abort the process. | |
const Exception | CPUTimeException |
This exception is thrown when the process has used up the CPU for too long. | |
const Exception | UserControlSignalException |
This exception is the common supertype of all control signal exceptions caused by the user. | |
const Exception | UserQuitException |
This exception is thrown when the user requests to quit the process. | |
const Exception | UserInterruptionException |
This exception is thrown when the user requests to interrupt the process. | |
const Exception | UserBreakException |
This exception is thrown when a user wishes to break the process. | |
const Exception | ProgramSignalException |
This exception is the common supertype of all user-defined signal exceptions. | |
const Exception | ProgramSignal1Exception |
This exception is thrown when user-defined conditions occur. | |
const Exception | ProgramSignal2Exception |
This exception is thrown when user-defined conditions occur. |
exceptions4c header file
This header file needs to be included from in order to be able to use any of the keywords of the the exception handling system:
try
catch
finally
throw
with
using
This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this software. If not, see <http://www.gnu.org/licenses/>.
#define acquireFile fopen |
Binds the acquisition of file to the standard function fopen
.
#define acquireMemory malloc |
Binds the acquisition of memory to the standard function malloc
.
#define catch | ( | _exception_ | ) |
else if( \ e4c_hook(e4c_catch, _exception_) \ )
Introduces a block of code capable of handling a specific kind of exceptions.
_exception_ | The kind of exceptions to be handled |
#define DEFINE_EXCEPTION | ( | _name_, | |||
_description_, | |||||
_super_ | ) |
#define disposeFile | ( | _file_, | |||
_failure_, | |||||
_context_ | ) | fclose(_file_) |
Binds the disposal of memory to the standard function fclose
.
#define disposeMemory | ( | _buffer_, | |||
_failure_, | |||||
_context_ | ) | free(_buffer_) |
Binds the disposal of memory to the standard function malloc
.
#define E4C_CONTEXT getExceptionContext() |
Accesses the current exception context of the program (or current thread).
#define EC4_ERRNO (EC4_FRAME->errorNumber) |
Accesses the error number of the current exception frame.
#define EC4_FAILED (EC4_STATUS_THROWN && EC4_STATUS_UNCAUGHT) |
Checks whether the current exception frame did fail and did not recover of the error.
#define EC4_FILE (EC4_FRAME->srcFile) |
Accesses the error file of the current exception frame.
#define EC4_FRAME (E4C_CONTEXT->currentFrame) |
Accesses the current frame of the exception context.
#define EC4_LINE (EC4_FRAME->srcLine) |
Accesses the error line of the current exception frame.
#define EC4_RECOVERED (EC4_STATUS_THROWN && !EC4_STATUS_UNCAUGHT) |
Checks whether the current exception frame did fail and then did recover of the error.
#define EC4_STATUS_THROWN (EC4_FRAME->thrown) |
Accesses the thrown
flag of the current exception frame.
The thrown
flag is set when some exception is thrown within the current exception frame, regardless of whether it gets caught or not.
#define EC4_STATUS_UNCAUGHT (EC4_FRAME->uncaught) |
Accesses the uncaught
flag of the current exception frame.
The uncaught
flag is set when some exception is caught within the current exception frame.
#define EC4_SUCCEED (!EC4_STATUS_THROWN) |
Checks whether the current exception frame did complete without an error.
#define EXCEPTION (EC4_FRAME->exception) |
Accesses the current exception being thrown from the current exception frame.
If no exception was thrown, then the value of EXCEPTION
will be INVALID_EXCEPTION
.
The flag EC4_STATUS_THROWN
can be checked in order to know if an exception was actually thrown.
#define finally |
else if( \ e4c_hook(e4c_finalize, INVALID_EXCEPTION) \ )
Introduces a block of code responsible for cleaning up the previous try
block.
#define SIGNAL_MAPPING | ( | _signalNumber_, | |||
_exception_ | ) |
{ \ signalNumber: _signalNumber_, \ exception: &_exception_, \ }
Represents a mapping literal.
_signalNumber_ | Signal to be converted | |
_exception_ | Exception representing the signal |
#define throw | ( | _exception_ | ) |
e4c_throw( \ _exception_, E4C_FILE, E4C_LINE \ )
Signals an exceptional situation represented by an exception object.
_exception_ | The exception to be thrown |
#define try |
E4C_LOOP(e4c_acquire) \ if( e4c_hook(e4c_try, INVALID_EXCEPTION) \ && e4c_next() )
Introduces a block of code aware of exceptions.
#define use |
#define using | ( | _type_, | |||
_resource_, | |||||
_args_ | ) |
Introduces a block of code with automatic acquisition and disposal of a resource.
_type_ | The type of the resource | |
_resource_ | The resource to be acquired, used and then disposed | |
_args_ | A list of arguments to be passed to acquisition function |
The specified resource will be aquired, used and then disposed. The automatic acquisition and disposal is achieved by calling the magic functions:
_type_ acquire_type_(_args_)
void dispose_type_(_resource_, failed, context)
The resource will be acquired implicitly by assigning it the result of the magic acquisition function acquire_type_
.
The semantics of the automatic acquisition and disposal are the same as for blocks introduced by the keyword with
.
#define usingFile | ( | _file_, | |||
_path_, | |||||
_mode_ | ) |
usingIfNotNull( \ File, _file_, (_path_, _mode_), FileOpenException \ )
Introduces a block of code with automatic acquisition and disposal of a file stream.
_file_ | The file to be acquired, used and then disposed | |
_path_ | The path of the file to be opened | |
_mode_ | The access mode of the file |
This macro lets you acquire and dispose (open and close) files according to the dispose pattern:
FILE * file; usingFile(file, "log.txt", "a"){ /* implicit: file = fopen("log.txt", "a"); */ fputs("hello, world!\n", file); /* implicit: fclose(file); */ }
If fopen
returns NULL
then the exception FileOpenException
will be automatically thrown.
The macro EC4_ERRNO
can be checked in order to find out the specific cause of the error.
#define usingIf | ( | _type_, | |||
_resource_, | |||||
_args_, | |||||
_cond_, | |||||
_exception_ | ) |
with(_resource_, dispose##_type_){ \ _resource_ = acquire##_type_ _args_; \ if( !(_cond_) ) throw(_exception_); \ }use
Introduces a block of code with automatic disposal of a resource and acquisition, under certain condition.
_type_ | The type of the resource | |
_resource_ | The resource to be acquired, used and then disposed | |
_args_ | A list of arguments to be passed to acquisition function | |
_cond_ | The condition which has to be satisfied in order to consider the acquisition complete | |
_exception_ | The exception to be thrown if the acquisition function does not satisfy the specified condition |
This macro will attempt the acquisition of the resource and then will check the given condition. If the condition evaluates to false, then the specified exception will be thrown, and therefore, the disposal of the resource will not take place.
This is a convenience macro for reusing legacy C standard functions which don't throw exceptions when the acquisition fails. For example:
# define acquireMemory malloc # define disposeMemory free # define usingMemory(_resource_, _bytes_) \ usingIf(Memory, _resource_, ( _bytes_ ), _resource_ != NULL, \ NotEnoughMemoryException )
#define usingIfNotNull | ( | _type_, | |||
_resource_, | |||||
_args_, | |||||
_exception_ | ) |
usingIf( \ _type_, _resource_, _args_, _resource_ != NULL, _exception_ \ )
Introduces a block of code with automatic disposal of a resource and acquisition, preventing null pointers.
_type_ | The type of the resource | |
_resource_ | The resource to be acquired, used and then disposed | |
_args_ | A list of arguments to be passed to acquisition function | |
_exception_ | The exception to be thrown if the acquisition function yields a NULL pointer. |
#define usingMemory | ( | _buffer_, | |||
_bytes_ | ) |
usingIfNotNull( \ Memory, _buffer_, (_bytes_), NotEnoughMemoryException \ )
Introduces a block of code with automatic acquisition and disposal of a memory buffer.
_buffer_ | The buffer to be acquired, used and then disposed | |
_bytes_ | The amount of memory to be allocated (in bytes) |
This macro lets you acquire and dispose memory according to the dispose pattern:
void * buffer; usingMemory(buffer, 1024){ /* implicit: buffer = malloc(1024); */ memset(buffer, 0, 1024); /* implicit: free(buffer); */ }
If malloc
returns NULL
then the exception NotEnoughMemoryException
will be automatically thrown.
#define with | ( | _resource_, | |||
_dispose_ | ) |
E4C_LOOP(e4c_begin) \ if( e4c_hook(e4c_dispose, INVALID_EXCEPTION) ){ \ ExceptionContext * context = E4C_CONTEXT; \ _dispose_(_resource_, context->currentFrame->thrown, context); \ }else if( e4c_hook(e4c_acquire, INVALID_EXCEPTION) ){
Opens a block of code with automatic disposal of a resource.
_resource_ | The resource to be disposed | |
_dispose_ | The name of the disposal function (or macro) |
The with
keyword is used to encapsulate the Dispose Pattern. It must be followed by the use
keyword.
In addition, the use
block can precede catch
and finally
blocks.
This pattern consists of two separate blocks and an implicit call to a given function:
with
block is responsible of the resource acquisition use
block makes use of the resource The with
keyword guarantees that the disposal function will be called if and only if the acquisition block completed without an error (i.e. no exteption being thrown from the acquisition block).
If the with
does not complete, then neither the disposal function nor the use
block will be ever executed.
The disposal function is called right after the use
block. If an exception was thrown, the catch
or finally
blocks (if any) will take place after the disposal of the resource.
When called, the disposal function will receive three arguments:
use
block did not complete This way, different actions can be taken depending on the success or failure of the block. For example, commiting or rolling back a transaction resource.
Legacy functions can be reused by defining macros. For example, a file resource needs to be closed regardless of the errors. Since the function fclose
only takes a parameter, we could provide disposeFile
as the disposal function and define the next macro:
# define disposeFile(_file_, _failed_, _context_) fclose(_file_)
The typical usage of a with
block will be:
with(foo, disposeFoo){ foo = acquireFoo(foobar); someAssertion(foo, bar); ... }use{ fooSomething(foo); ... }catch(FooAcquisitionFailed){ recover1(); ... }catch(somethingElseFailed){ recover2(); ... }finally{ cleanup(); ... }
Nonetheless, one-liners fit nicely too:
with(foo, disposeFoo) foo = acquireFoo(bar, foobar); use fooSomething(foo);
There is a way to lighten up even more this pattern by defining convenience macros, customized for a specific kind of resources. For example, usingFile
or usingMemory
.
typedef void(* UncaughtHandler)(Exception exception, const char *srcFile, int srcLine, int errorNumber) |
This is the signature of a function which will be executed in the event of an uncaught exception.
These functions are not allowed to try and recover the current exception context. Moreover, the program (or current thread) will terminate right after the function returns.
exception | The uncaught exception | |
srcFile | The path of the source code file from which the exception was thrown | |
srcLine | The number of line from which the exception was thrown | |
errorNumber | The value of errno at the time the exception was thrown |
enum e4c_Stage |
Represents the current execution status of an exception frame.
Note: this type is internal to the framework, and not intended to be used by the user of the library.
Every group of try
/catch
/finally
blocks goes through a set of execution stages. Each stage determines which one of the different blocks is run.
void beginExceptionContext | ( | unsigned char | handleSignals, | |
UncaughtHandler | uncaughtHandler | |||
) |
Opens an exception context.
This function creates and initializes the exception context to be used by the the program until endExceptionContext
is called.
A function can be specified to be called in the event of an uncaught exception. There exceptions, if handleSignals
is true
.
In addition, if handleSignals
is true
, beginExceptionContext
will sets u the default mapping to convert signals into exceptions. This goal is achieved through the standard function signal
. Note that the behaviour of signal
is undefined in a multithreaded program, so use this feature with caution.
handleSignals | If true , the signal handling system will be set up with the default mapping. | |
uncaughtHandler | If not NULL , this function will be called in the event of an uncaught exception. |
void dumpException | ( | Exception | exception, | |
const char * | srcFile, | |||
int | srcLine, | |||
int | errorNumber | |||
) |
Prints a fatal error message regarding the specified exception.
This is a convenience function for showing an error message through the standard error output. It can be passed to beginExceptionContext
as the handler for uncaught exceptions.
exception | The uncaught exception | |
srcFile | The path of the source code file from which the exception was thrown | |
srcLine | The number of line from which the exception was thrown | |
errorNumber | The value of errno at the time the exception was thrown |
void endExceptionContext | ( | ) |
Closes the current exception context.
This function closes the current exception context.
ExceptionContext* getExceptionContext | ( | ) |
Retrieves the current exception context of the program (or current thread).
The exception context must be properly started and finished by calling the functions beginExceptionContext
and andExceptionContext
in order to be accessed.
void initializeExceptionContext | ( | ExceptionContext * | context | ) |
Initializes new exception context.
This is a convenience function for creating a new exception context.
context | Pointer to the new context to be initialized |
const Exception newException | ( | const char * | name, | |
const char * | description, | |||
const Exception * | super | |||
) |
Creates a new exception.
This is a convenience function for creating a new exception.
name | Name of the new exception | |
description | Description of the new exception | |
super | Address of the supertype of the new exception |
void printExceptionHierarchy | ( | Exception | exception | ) |
Prints an exception's hierarchy graph.
This is a convenience function for printing an exception's hierarchy graph with simple ASCII
characters.
exception | The exception whose hierarchy is to be printed |
void setSignalHandlers | ( | const SignalMapping * | mapping, | |
int | mappings | |||
) |
Sets up the signal handling system.
This function receives an array of mappings between the signals to be handled and the corresponding exception to be thrown.
mapping | The array of mappings | |
mappings | The number of elements in the array |
const Exception AbortException |
This exception is thrown to abort the process.
AbortException represents SIGABRT
, the signal sent by computer programs to abort the process.
const Exception ArithmeticException |
This exception is thrown when the process performs an erroneous arithmetic operation.
ArithmeticException represents SIGFPE
, the signal sent to a process when it performs an erroneous arithmetic operation.
const Exception BadPointerException |
This exception is thrown when the process tries to dereference an invalid pointer.
BadPointerException represents SIGSEGV
, the signal sent to a process when it makes an invalid memory reference, or segmentation fault.
const Exception BrokenPipeException |
This exception is thrown when the process attempts to write to a broken pipe.
BrokenPipeException represents SIGPIPE
, the signal sent to a process when it attempts to write to a pipe without a process connected to the other end.
This exception is the common supertype of all control signal exceptions.
Control signal exceptions are thrown when the process needs to be controlled by the user or some other process.
This is the hierarchy of control signal exceptions:
const Exception CPUTimeException |
This exception is thrown when the process has used up the CPU for too long.
CPUTimeException represents SIGXCPU
, the signal sent to a process when it has used up the CPU for a duration that exceeds a certain predetermined user-settable value.
This exception is the common supertype of all error signal exceptions.
Error signal exceptions are thrown when some error prevents the program to keep executing its normal flow, for example:
This is the hierarchy of error signal exceptions:
const Exception FileOpenException |
This exception is thrown when a file cannot be opened.
FileOpenException is thrown by usingFile
when fopen
returns NULL
for whatever reason.
The value of errno
at the time the exception was thrown (right after fopen
) can be accessed through the macro EC4_ERRNO
.
const Exception HangUpException |
This exception is thrown when the process' terminal is closed.
HangUpException represents SIGHUP
, the signal sent to a process when its controlling terminal is closed.
This exception is thrown when the process attempts to execute an illegal instruction.
IllegalInstructionException represents SIGILL
, the signal sent to a process when it attempts to execute a malformed, unknown, or privileged instruction.
const Exception INVALID_EXCEPTION |
This represents an invalid exception.
INVALID_EXCEPTION
honors the Null Object pattern:
const Exception KillException |
This exception is thrown to terminate the process immediately.
KillException represents SIGKILL
, the signal sent to a process to cause it to terminate immediately.
Since SIGKILL
is unblock-able, it cannot be handled and converted to this exception automatically.
This exception is thrown when the system runs out of memory.
NotEnoughMemoryException is thrown when there is not enough memory to continue the execution of the program.
This exception is thrown when an unexpected null pointer is found.
NullPointerException is thrown when some part of the program gets a pointer which was expected or required to contain a valid memory address.
This exception is thrown when user-defined conditions occur.
ProgramSignal1Exception represents SIGUSR1
, the signal sent to a process to indicate user-defined conditions.
This exception is thrown when user-defined conditions occur.
ProgramSignal2Exception represents SIGUSR1
, the signal sent to a process to indicate user-defined conditions.
This exception is the common supertype of all user-defined signal exceptions.
User-defined signal exceptions are thrown to indicate user-defined conditions.
This is the hierarchy of user-defined signal exceptions:
const Exception RuntimeException |
This is the root of the exception pseudo-hierarchy.
RuntimeException is the common supertype of all exceptions.
This is the hierarchy of runtime exceptions:
This exception is thrown when a time limit has elapsed.
SignalAlarmException represents SIGALRM
, the signal sent to a process when a time limit has elapsed.
This exception is thrown when a child process terminates.
SignalChildException represents SIGCHLD
, the signal sent to a process when a child process terminates (ignored by default).
const Exception SignalException |
This exception is the common supertype of all signal exceptions.
Signal exceptions are thrown when some signal is sent to the process.
A signal can be generated by calling raise
.
This is the hierarchy of signal exceptions:
const Exception SignalTrapException |
This exception is thrown when a condition arises that a debugger has requested to be informed of.
SignalTrapException represents SIGTRAP
, the signal sent to a process when a condition arises that a debugger has requested to be informed of.
const Exception StopException |
This exception is thrown to stop the process for later resumption.
StopException represents SIGSTOP
, the signal sent to a process to stop it for later resumption.
Since SIGSTOP
is unblock-able, it cannot be handled and converted to this exception automatically.
This exception is thrown to request the termination of the process.
TerminationException represents SIGTERM
, the signal sent to a process to request its termination.
const Exception UserBreakException |
This exception is thrown when a user wishes to break the process.
UserBreakException represents SIGBREAK
, the signal sent to a process by its controlling terminal when a user wishes to break it.
This exception is the common supertype of all control signal exceptions caused by the user.
User control signal exceptions are thrown when the process needs to be controlled by the user.
This is the hierarchy of control signal exceptions caused by the user:
This exception is thrown when the user requests to interrupt the process.
UserInterruptionException represents SIGINT
, the signal sent to a process by its controlling terminal when a user wishes to interrupt it.
const Exception UserQuitException |
This exception is thrown when the user requests to quit the process.
UserQuitException represents SIGQUIT
, the signal sent to a process by its controlling terminal when the user requests that the process dump core.