$darkmode
Libical API Documentation 4.0 STABLE VERSION Visit the v3.0 documentation
icalerror.c File Reference

Error handling for libical. More...

Go to the source code of this file.

Functions

void icalerror_backtrace (void)
 Prints backtrace. More...
 
void icalerror_clear_errno (void)
 Resets icalerrno to ICAL_NO_ERROR. More...
 
bool icalerror_get_errors_are_fatal (void)
 Determine if errors are fatal. More...
 
icalerrorenumicalerror_icalerrno (void)
 Returns the current icalerrno value. More...
 
void icalerror_set_errno (icalerrorenum x)
 Sets the icalerrno to a given error. More...
 
void icalerror_set_errors_are_fatal (bool fatal)
 Change if errors are fatal. More...
 

Detailed Description

Error handling for libical.

Definition in file icalerror.c.

Function Documentation

void icalerror_backtrace ( void  )

Prints backtrace.

Note
Only works on systems that support it (HAVE_BACKTRACE enabled).
Usage

Definition at line 101 of file icalerror.c.

void icalerror_clear_errno ( void  )

Resets icalerrno to ICAL_NO_ERROR.

Usage

Definition at line 85 of file icalerror.c.

bool icalerror_get_errors_are_fatal ( void  )

Determine if errors are fatal.

Returns
True if libical errors are fatal
Usage
  • ```c if(icalerror_get_errors_are_fatal()) { // since errors are fatal, this will abort the // program. icalerror_set_errno(ICAL_PARSE_ERROR); }
  • ```

Definition at line 36 of file icalerror.c.

icalerrorenum* icalerror_icalerrno ( void  )

Returns the current icalerrno value.

Returns
A pointer to the current icalerrno value

Yields a pointer to the current icalerrno value. This can be used to access (read from and write to) it.

Examples
  • ```c assert(*icalerror_icalerrno() == icalerrno);
  • ```

Definition at line 58 of file icalerror.c.

void icalerror_set_errno ( icalerrorenum  x)

Sets the icalerrno to a given error.

Parameters
xThe error to set icalerrno to

Sets icalerrno to the error given in x. Additionally, if the error is an ICAL_ERROR_FATAL or if it's an ICAL_ERROR_DEFAULT and icalerror_get_errors_are_fatal() is true, it prints a warning to stderr and aborts the process.

Usage
  • ```c icalerror_set_errno(ICAL_PARSE_ERROR);
  • ```

Definition at line 90 of file icalerror.c.

void icalerror_set_errors_are_fatal ( bool  fatal)

Change if errors are fatal.

Parameters
fatalIf true, libical aborts after a call to icalerror_set_error()
Warning
NOT THREAD SAFE: it is recommended that you do not change this in a multithreaded program.
Usage
  • ```c icalerror_set_errors_are_fatal(true); // default icalerror_set_errors_are_fatal(false);
  • ```

Definition at line 31 of file icalerror.c.