exceptions4c 4.0
Exceptions for C
Loading...
Searching...
No Matches
e4c_exception_type Struct Reference

Represents a category of problematic situations in a program. More...

#include <exceptions4c.h>

Data Fields

const struct e4c_exception_typesupertype
 The possibly-null supertype of this type.
 
const char * default_message
 The default message for new exceptions of this type.
 

Detailed Description

Represents a category of problematic situations in a program.

Defines a kind of error or exceptional condition that a program MAY want to THROW and CATCH. It serves as a way to group related issues that share common characteristics.

Exception types SHOULD be defined as const.

/* Generic errors */
const struct e4c_exception_type NOT_ENOUGH_MEMORY = {NULL, "Not enough memory"};
const struct e4c_exception_type TIMED_OUT = {NULL, "Timed out"};
/* Base exception for all pet-related errors */
const struct e4c_exception_type PET_ERROR = {NULL, "Pet error"};
/* Specific types of pet errors */
const struct e4c_exception_type PET_NOT_FOUND = {&PET_ERROR, "Pet not found"};
const struct e4c_exception_type PET_STORE_CLOSED = {&PET_ERROR, "Pet store closed"};
See also
THROW
CATCH

Field Documentation

◆ supertype

const struct e4c_exception_type* supertype

The possibly-null supertype of this type.

◆ default_message

const char* default_message

The default message for new exceptions of this type.


The documentation for this struct was generated from the following file: