MySQL 9.1.0
Source Code Documentation
sql_exception_handler.cc File Reference

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

#include "sql/sql_exception_handler.h"
#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/algorithms/detail/has_self_intersections.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp>
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/core/exception.hpp>
#include <new>
#include <regex>
#include <stdexcept>
#include <string>
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysqld_error.h"
#include "sql/gis/buffer.h"
#include "sql/gis/functor.h"
#include "sql/gis/gc_utils.h"

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 defines functions to convert exceptions to MySQL error messages.

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