MySQL 8.4.3
Source Code Documentation
sql_exception_handler.h File Reference

This file declares functions to convert exceptions to MySQL error messages. More...

Go to the source code of this file.

Functions

void handle_std_exception (const char *funcname)
 Handle an exception of any type. More...
 
void handle_gis_exception (const char *funcname)
 Handle a GIS exception of any type. More...
 

Detailed Description

This file declares functions to convert exceptions to MySQL error messages.

The pattern for use in other functions is:

try
{
something_that_throws();
}
catch (...)
{
handle_foo_exception("function_name");
}

There are different handlers for different use cases.

Function Documentation

◆ handle_gis_exception()

void handle_gis_exception ( const char *  funcname)

Handle a GIS exception of any type.

This function constitutes the exception handling barrier between Boost.Geometry and MySQL code. It handles all exceptions thrown in GIS code and raises the corresponding error in MySQL.

Pattern for use in other functions:

try
{
something_that_throws();
}
catch (...)
{
}
void handle_gis_exception(const char *funcname)
Handle a GIS exception of any type.
Definition: sql_exception_handler.cc:92

Other exception handling code put into the catch block, before or after the call to handle_gis_exception(), must not throw exceptions.

Parameters
funcnameFunction name for use in error message
See also
handle_std_exception

◆ handle_std_exception()

void handle_std_exception ( const char *  funcname)

Handle an exception of any type.

Code that could throw exceptions should be wrapped in try/catch, and the catch block should raise a corresponding MySQL error. If this function is called from the catch block, it will raise a specialized error message for many of the std::exception subclasses, or a more generic error message if it is not a std::exception.

Parameters
funcnamethe name of the function that caught an exception
See also
handle_gis_exception