1 #ifndef SQL_EXCEPTION_HANDLER_H_INCLUDED 2 #define SQL_EXCEPTION_HANDLER_H_INCLUDED 3 4 /* 5 Copyright (c) 2017, 2021, Oracle and/or its affiliates. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License, version 2.0, 9 as published by the Free Software Foundation. 10 11 This program is also distributed with certain software (including 12 but not limited to OpenSSL) that is licensed under separate terms, 13 as designated in a particular file or component or in included license 14 documentation. The authors of MySQL hereby grant you an additional 15 permission to link the program and your derivative works with the 16 separately licensed software that they have included with MySQL. 17 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License, version 2.0, for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software Foundation, 25 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 26 */ 27 28 /** 29 @file 30 31 @brief This file declares functions to convert exceptions to MySQL 32 error messages. 33 34 The pattern for use in other functions is: 35 36 @code 37 try 38 { 39 something_that_throws(); 40 } 41 catch (...) 42 { 43 handle_foo_exception("function_name"); 44 } 45 @endcode 46 47 There are different handlers for different use cases. 48 */ 49 50 /** 51 Handle an exception of any type. 52 53 Code that could throw exceptions should be wrapped in try/catch, and 54 the catch block should raise a corresponding MySQL error. If this 55 function is called from the catch block, it will raise a specialized 56 error message for many of the std::exception subclasses, or a more 57 generic error message if it is not a std::exception. 58 59 @param funcname the name of the function that caught an exception 60 61 @see handle_gis_exception 62 */ 63 void handle_std_exception(const char *funcname); 64 65 #endif // SQL_EXCEPTION_HANDLER_H_INCLUDED 66