Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:54:04

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/json
0008 //
0009 
0010 #ifndef BOOST_JSON_ERROR_HPP
0011 #define BOOST_JSON_ERROR_HPP
0012 
0013 #include <boost/json/detail/config.hpp>
0014 
0015 namespace boost {
0016 namespace json {
0017 
0018 /** Error codes returned by JSON operations
0019 
0020 */
0021 enum class error
0022 {
0023     //
0024     // parse errors
0025     //
0026 
0027     /// syntax error
0028     syntax = 1,
0029 
0030     /// extra data
0031     extra_data,
0032 
0033     /// incomplete JSON
0034     incomplete,
0035 
0036     /// exponent too large
0037     exponent_overflow,
0038 
0039     /// too deep
0040     too_deep,
0041 
0042     /// illegal leading surrogate
0043     illegal_leading_surrogate,
0044 
0045     /// illegal trailing surrogate
0046     illegal_trailing_surrogate,
0047 
0048     /// expected hex digit
0049     expected_hex_digit,
0050 
0051     /// expected utf16 escape
0052     expected_utf16_escape,
0053 
0054     /// An object contains too many elements
0055     object_too_large,
0056 
0057     /// An array contains too many elements
0058     array_too_large,
0059 
0060     /// A key is too large
0061     key_too_large,
0062 
0063     /// A string is too large
0064     string_too_large,
0065 
0066     /// A number is too large
0067     number_too_large,
0068 
0069     /// error occured when trying to read input
0070     input_error,
0071 
0072     //
0073     // generic errors
0074     //
0075 
0076     /// An exception was thrown during operation
0077     exception,
0078 
0079     /// A requested element is outside of container's range
0080     out_of_range,
0081 
0082     /// test failure
0083     test_failure,
0084 
0085     //
0086     // JSON Pointer errors
0087     //
0088 
0089     /// missing slash character before token reference
0090     missing_slash,
0091 
0092     /// invalid escape sequence
0093     invalid_escape,
0094 
0095     /// token should be a number but cannot be parsed as such
0096     token_not_number,
0097 
0098     /// current value is neither an object nor an array
0099     value_is_scalar,
0100 
0101     /// current value does not contain referenced value
0102     not_found,
0103 
0104     /// token cannot be represented by std::size_t
0105     token_overflow,
0106 
0107     /// past-the-end index is not supported
0108     past_the_end,
0109 
0110     //
0111     // Conversion errors
0112     //
0113 
0114     /// JSON number was expected during conversion
0115     not_number,
0116 
0117     /// number cast is not exact
0118     not_exact,
0119 
0120     /// JSON null was expected during conversion
0121     not_null,
0122 
0123     /// JSON bool was expected during conversion
0124     not_bool,
0125 
0126     /// JSON array was expected during conversion
0127     not_array,
0128 
0129     /// JSON object was expected during conversion
0130     not_object,
0131 
0132     /// JSON string was expected during conversion
0133     not_string,
0134 
0135     /// std::int64_t was expected during conversion
0136     not_int64,
0137 
0138     /// std::uint64_t was expected during conversion
0139     not_uint64,
0140 
0141     /// `double` was expected during conversion
0142     not_double,
0143 
0144     /// JSON integer was expected during conversion
0145     not_integer,
0146 
0147     /// source composite has size incompatible with target
0148     size_mismatch,
0149 
0150     /// none of the possible conversions were successful
0151     exhausted_variants,
0152 
0153     /// the key does not correspond to a known name
0154     unknown_name,
0155 };
0156 
0157 /** Error conditions corresponding to JSON errors
0158 */
0159 enum class condition
0160 {
0161     /// A parser-related error
0162     parse_error = 1,
0163 
0164     /// An error related to parsing JSON pointer string
0165     pointer_parse_error,
0166 
0167     /// An error related to applying JSON pointer string to a value
0168     pointer_use_error,
0169 
0170     /// A conversion error
0171     conversion_error,
0172 
0173     /// A generic error
0174     generic_error,
0175 };
0176 
0177 } // namespace json
0178 } // namespace boost
0179 
0180 #include <boost/json/impl/error.hpp>
0181 
0182 #endif