Data Structures | Functions | Variables

# exception.c File Reference

`#include "wizard/studio.h"`
`#include "wizard/client.h"`
`#include "wizard/exception.h"`
`#include "wizard/exception-private.h"`
`#include "wizard/hashmap.h"`
`#include "wizard/log.h"`
`#include "wizard/memory_.h"`
`#include "wizard/string_.h"`
`#include "wizard/utility.h"`
`#include "wizard/wizard.h"`

## Data Structures
struct | _ExceptionInfo
## Functions
static void | DefaultErrorHandler (const ExceptionType, const char *, const char *)
static void | DefaultFatalErrorHandler (const ExceptionType, const char *, const char *)
static void | DefaultWarningHandler (const ExceptionType, const char *, const char *)
WizardExport ExceptionInfo * | AcquireExceptionInfo (void)
static void * | DestroyExceptionElement (void *exception)
WizardExport void | ClearWizardException (ExceptionInfo *exception)
WizardExport void | CatchException (ExceptionInfo *exception)
static void | DefaultErrorHandler (const ExceptionType wizard_unused(severity), const char *reason, const char *description)
static void | DefaultWarningHandler (const ExceptionType wizard_unused(severity), const char *reason, const char *description)
WizardExport ExceptionInfo * | DestroyExceptionInfo (ExceptionInfo *exception)
WizardExport void | GetExceptionInfo (ExceptionInfo *exception)
WizardExport char * | GetExceptionMessage (const int error)
static const char * | ExceptionSeverityToTag (const ExceptionType severity)
WizardExport const char * | GetLocaleExceptionMessage (const ExceptionType severity, const char *tag)
WizardExport ExceptionType | GetExceptionSeverity (const ExceptionInfo *exception)
WizardExport void | InheritException (ExceptionInfo *exception, const ExceptionInfo *relative)
WizardExport void | WizardError (const ExceptionType error, const char *reason, const char *description)
WizardExport void | WizardFatalError (const ExceptionType error, const char *reason, const char *description)
WizardExport void | WizardWarning (const ExceptionType warning, const char *reason, const char *description)
WizardExport ErrorHandler | SetErrorHandler (ErrorHandler handler)
WizardExport FatalErrorHandler | SetFatalErrorHandler (FatalErrorHandler handler)
WizardExport WarningHandler | SetWarningHandler (WarningHandler handler)
WizardExport WizardBooleanType | ThrowException (ExceptionInfo *exception, const ExceptionType severity, const char *reason, const char *description)
WizardExport WizardBooleanType | ThrowWizardExceptionList (ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *format, va_list operands)
WizardExport WizardBooleanType | ThrowWizardException (ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *format,...)
## Variables
static ErrorHandler | error_handler = DefaultErrorHandler
static FatalErrorHandler | fatal_error_handler = DefaultFatalErrorHandler
static WarningHandler | warning_handler = DefaultWarningHandler

## Function Documentation

WizardExport ExceptionInfo* AcquireExceptionInfo | ( | void |  | ) |

References AcquireWizardMemory(), GetExceptionInfo(), _ExceptionInfo::relinquish, ResetWizardMemory(), ResourceFatalError, _ExceptionInfo::signature, and ThrowFatalException.

Referenced by AcquireRandomInfo(), CloseWizardLog(), GenerateSecretKey(), IsEventLogging(), LogWizardEventList(), SetLogEventMask(), SetLogFormat(), TranslateEvent(), and WizardToMime().

WizardExport void CatchException | ( | ExceptionInfo * | exception | ) |

References ClearWizardException(), _ExceptionInfo::description, ErrorException, _ExceptionInfo::exceptions, FatalErrorException, GetNextValueInLinkedList(), LockSemaphoreInfo(), _ExceptionInfo::reason, ResetLinkedListIterator(), _ExceptionInfo::semaphore, _ExceptionInfo::severity, _ExceptionInfo::signature, UnlockSemaphoreInfo(), WarningException, WizardError(), WizardFatalError(), WizardSignature, and WizardWarning().

WizardExport void ClearWizardException | ( | ExceptionInfo * | exception | ) |

References _ExceptionInfo::description, DestroyExceptionElement(), _ExceptionInfo::exceptions, LockSemaphoreInfo(), _ExceptionInfo::reason, RemoveLastElementFromLinkedList(), _ExceptionInfo::semaphore, _ExceptionInfo::severity, _ExceptionInfo::signature, UnlockSemaphoreInfo(), and WizardSignature.

Referenced by CatchException(), and LoadMimeLists().

static void DefaultErrorHandler | ( | const | ExceptionType,
|  | const char * | ,
|  | const char * |  |
| ) |  |  | `[static]`

static void DefaultErrorHandler | ( | const ExceptionType | wizard_unusedseverity,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  | `[static]`

References GetClientName().

static void DefaultFatalErrorHandler | ( | const ExceptionType | severity,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

References GetClientName(), and WizardsToolkitTerminus().

static void DefaultWarningHandler | ( | const ExceptionType | wizard_unusedseverity,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  | `[static]`

References GetClientName().

static void DefaultWarningHandler | ( | const | ExceptionType,
|  | const char * | ,
|  | const char * |  |
| ) |  |  |

static void* DestroyExceptionElement | ( | void * | exception | ) | `[static]`

References _ExceptionInfo::description, _ExceptionInfo::reason, and RelinquishWizardMemory().

Referenced by ClearWizardException().

WizardExport ExceptionInfo* DestroyExceptionInfo | ( | ExceptionInfo * | exception | ) |

References DestroyLinkedList(), DestroySemaphoreInfo(), _ExceptionInfo::exceptions, LockSemaphoreInfo(), _ExceptionInfo::relinquish, RelinquishWizardMemory(), _ExceptionInfo::semaphore, _ExceptionInfo::severity, _ExceptionInfo::signature, UnlockSemaphoreInfo(), WizardFalse, and WizardSignature.

Referenced by AcquireRandomInfo(), CloseWizardLog(), GenerateSecretKey(), IsEventLogging(), LogWizardEventList(), SetLogEventMask(), SetLogFormat(), TranslateEvent(), and WizardToMime().

static const char* ExceptionSeverityToTag | ( | const ExceptionType | severity | ) | `[static]`

References AuthenticateError, AuthenticateFatalError, AuthenticateWarning, BlobError, BlobFatalError, BlobWarning, CipherError, CipherFatalError, CipherWarning, ConfigureError, ConfigureFatalError, ConfigureWarning, EntropyError, EntropyFatalError, EntropyWarning, FileError, FileFatalError, FileWarning, HashError, HashFatalError, HashmapFatalError, HashmapWarning, HashWarning, KeymapError, KeymapFatalError, KeymapWarning, KeyringError, KeyringFatalError, KeyringWarning, LogFatalError, LogWarning, MACError, MACFatalError, MACWarning, OptionError, OptionFatalError, OptionWarning, ParseError, ParseFatalError, ParseWarning, RandomError, RandomFatalError, RandomWarning, ResourceError, ResourceFatalError, ResourceWarning, SplayTreeError, SplayTreeFatalError, SplayTreeWarning, StringError, StringFatalError, StringWarning, UserError, UserFatalError, and UserWarning.

Referenced by GetLocaleExceptionMessage().

WizardExport void GetExceptionInfo | ( | ExceptionInfo * | exception | ) |

References AllocateSemaphoreInfo(), _ExceptionInfo::exceptions, NewLinkedList(), ResetWizardMemory(), _ExceptionInfo::semaphore, _ExceptionInfo::severity, and _ExceptionInfo::signature.

Referenced by AcquireExceptionInfo().

WizardExport char* GetExceptionMessage | ( | const int | error | ) |

References ConstantString(), and CopyWizardString().

WizardExport ExceptionType GetExceptionSeverity | ( | const ExceptionInfo * | exception | ) |

References _ExceptionInfo::severity, _ExceptionInfo::signature, and WizardSignature.

WizardExport const char* GetLocaleExceptionMessage | ( | const ExceptionType | severity,
|  | const char * | tag |
| ) |  |  |

References ExceptionSeverityToTag(), FormatWizardString(), GetLocaleMessage(), and MaxTextExtent.

WizardExport void InheritException | ( | ExceptionInfo * | exception,
|  | const ExceptionInfo * | relative |
| ) |  |  |

References _ExceptionInfo::description, _ExceptionInfo::exceptions, GetNextValueInLinkedList(), LockSemaphoreInfo(), _ExceptionInfo::reason, ResetLinkedListIterator(), _ExceptionInfo::semaphore, _ExceptionInfo::severity, _ExceptionInfo::signature, ThrowException(), UnlockSemaphoreInfo(), and WizardSignature.

WizardExport ErrorHandler SetErrorHandler | ( | ErrorHandler | handler | ) |

References error_handler.

WizardExport FatalErrorHandler SetFatalErrorHandler | ( | FatalErrorHandler | handler | ) |

References fatal_error_handler.

WizardExport WarningHandler SetWarningHandler | ( | WarningHandler | handler | ) |

References warning_handler.

WizardExport WizardBooleanType ThrowException | ( | ExceptionInfo * | exception,
|  | const ExceptionType | severity,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

References AcquireWizardMemory(), AppendValueToLinkedList(), ConstantString(), _ExceptionInfo::description, _ExceptionInfo::exceptions, GetLastValueInLinkedList(), LocaleCompare(), _ExceptionInfo::reason, ResetWizardMemory(), ResourceFatalError, _ExceptionInfo::severity, _ExceptionInfo::signature, ThrowFatalException, WizardSignature, and WizardTrue.

Referenced by InheritException(), and ThrowWizardExceptionList().

WizardExport WizardBooleanType ThrowWizardException | ( | ExceptionInfo * | exception,
|  | const char * | module,
|  | const char * | function,
|  | const size_t | line,
|  | const ExceptionType | severity,
|  | const char * | format,
|  |  | ... |
| ) |  |  |

References ThrowWizardExceptionList().

Referenced by AcquireFileInfo(), AcquireFileLock(), AcquireUniqueFilename(), AcquireUniqueFileResource(), DestroyFile(), DestroyFileInfo(), ExportKeyringKey(), FileToBlob(), GenerateEntropicChaos(), GetConfigureInfo(), GetConfigureOptions(), GetEntropyFromReservoir(), GetLogInfo(), GetPassphrase(), ImportKeyringKey(), IncreaseBZIP(), IncreaseLZMA(), IncreaseZIP(), LoadConfigureList(), LoadConfigureLists(), LoadLogList(), LoadLogLists(), LoadMimeList(), NewXMLTree(), OpenBlob(), ParseCloseTag(), ParseInternalDoctype(), PrintKeyringProperties(), RelinquishFileLock(), RestoreBZIP(), RestoreLZMA(), RestoreZIP(), and SaveEntropyToReservoir().

WizardExport WizardBooleanType ThrowWizardExceptionList | ( | ExceptionInfo * | exception,
|  | const char * | module,
|  | const char * | function,
|  | const size_t | line,
|  | const ExceptionType | severity,
|  | const char * | format,
|  | va_list | operands |
| ) |  |  |

References ErrorException, ExceptionEvent, FormatWizardString(), LogWizardEvent(), MaxTextExtent, _ExceptionInfo::severity, _ExceptionInfo::signature, ThrowException(), vsnprintf, WarningEvent, and WizardSignature.

Referenced by ThrowWizardException().

WizardExport void WizardError | ( | const ExceptionType | error,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

References error_handler.

Referenced by CatchException().

WizardExport void WizardFatalError | ( | const ExceptionType | error,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

References fatal_error_handler.

Referenced by CatchException().

WizardExport void WizardWarning | ( | const ExceptionType | warning,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

References warning_handler.

Referenced by CatchException().

## Variable Documentation

ErrorHandler error_handler = DefaultErrorHandler`[static]`

Referenced by SetErrorHandler(), and WizardError().

FatalErrorHandler fatal_error_handler = DefaultFatalErrorHandler`[static]`

Referenced by SetFatalErrorHandler(), and WizardFatalError().

WarningHandler warning_handler = DefaultWarningHandler`[static]`

Referenced by SetWarningHandler(), and WizardWarning().