MySQL 8.2.0
Source Code Documentation
json_error_handler.h
Go to the documentation of this file.
1#ifndef JSON_ERROR_HANDLER_INCLUDED
2#define JSON_ERROR_HANDLER_INCLUDED
3
4/* Copyright (c) 2022, 2023, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is also distributed with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have included with MySQL.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26#include <cstdlib>
27#include <functional>
28
30 std::function<void(const char *parse_err, size_t err_offset)>;
31using JsonErrorHandler = std::function<void()>;
32
33#ifdef MYSQL_SERVER
34
36 public:
37 JsonParseDefaultErrorHandler(const char *func_name, int arg_idx)
38 : m_func_name(func_name), m_arg_idx(arg_idx) {}
39
40 void operator()(const char *parse_err, size_t err_offset) const;
41
42 private:
43 const char *m_func_name;
44 const int m_arg_idx;
45};
46
51
52#endif // MYSQL_SERVER
53#endif // JSON_ERROR_HANDLER_INCLUDED
Definition: json_error_handler.h:35
const int m_arg_idx
Definition: json_error_handler.h:44
JsonParseDefaultErrorHandler(const char *func_name, int arg_idx)
Definition: json_error_handler.h:37
void operator()(const char *parse_err, size_t err_offset) const
Definition: json_error_handler.cc:29
const char * m_func_name
Definition: json_error_handler.h:43
void JsonValueTooBigErrorHandler()
Definition: json_error_handler.cc:37
void JsonDepthErrorHandler()
Definition: json_error_handler.cc:35
std::function< void()> JsonErrorHandler
Definition: json_error_handler.h:31
void InvalidJsonErrorHandler()
Definition: json_client_library_main.cc:42
void JsonKeyTooBigErrorHandler()
Definition: json_error_handler.cc:36
std::function< void(const char *parse_err, size_t err_offset)> JsonParseErrorHandler
Definition: json_error_handler.h:30