<areahref="classnlohmann_1_1detail_1_1exception.html"title="general exception of the basic_json class"alt="nlohmann::detail::exception"shape="rect"coords="0,0,183,24"/>
<trclass="inherit_header pub_methods_classnlohmann_1_1detail_1_1exception"><tdcolspan="2"onclick="javascript:toggleInherit('pub_methods_classnlohmann_1_1detail_1_1exception')"><imgsrc="closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="classnlohmann_1_1detail_1_1exception.html">nlohmann::detail::exception</a></td></tr>
<trclass="memdesc:a0d4589a3fb54e81646d986c05efa3b9a inherit pub_attribs_classnlohmann_1_1detail_1_1exception"><tdclass="mdescLeft"> </td><tdclass="mdescRight">the id of the exception <br/></td></tr>
<divclass="textblock"><p>exception indicating access out of the defined range </p>
<p>This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance in case of array indices or nonexisting object keys.</p>
<p>Exceptions have ids 4xx.</p>
<tableclass="markdownTable">
<trclass="markdownTableHead">
<thclass="markdownTableHeadNone">name / id </th><thclass="markdownTableHeadNone">example message </th><thclass="markdownTableHeadNone">description </th></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.401 </td><tdclass="markdownTableBodyNone">array index 3 is out of range </td><tdclass="markdownTableBodyNone">The provided array index <em>i</em> is larger than <em>size-1</em>. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.402 </td><tdclass="markdownTableBodyNone">array index '-' (3) is out of range </td><tdclass="markdownTableBodyNone">The special array index <code>-</code> in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.403 </td><tdclass="markdownTableBodyNone">key 'foo' not found </td><tdclass="markdownTableBodyNone">The provided key was not found in the JSON object. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.404 </td><tdclass="markdownTableBodyNone">unresolved reference token 'foo' </td><tdclass="markdownTableBodyNone">A reference token in a JSON Pointer could not be resolved. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.405 </td><tdclass="markdownTableBodyNone">JSON pointer has no parent </td><tdclass="markdownTableBodyNone">The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.406 </td><tdclass="markdownTableBodyNone">number overflow parsing '10E1000' </td><tdclass="markdownTableBodyNone">A parsed number could not be stored as without changing it to NaN or INF. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.407 </td><tdclass="markdownTableBodyNone">number overflow serializing '9223372036854775808' </td><tdclass="markdownTableBodyNone">UBJSON and BSON only support integer numbers up to 9223372036854775807. (until version 3.8.0) </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.408 </td><tdclass="markdownTableBodyNone">excessive array size: 8658170730974374167 </td><tdclass="markdownTableBodyNone">The size (following <code>#</code>) of an UBJSON array or object exceeds the maximal capacity. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.out_of_range.409 </td><tdclass="markdownTableBodyNone">BSON key cannot contain code point U+0000 (at byte 2) </td><tdclass="markdownTableBodyNone">Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string </td></tr>
</table>
<p>@liveexample{The following code shows how an <code><aclass="el"href="classnlohmann_1_1detail_1_1out__of__range.html"title="exception indicating access out of the defined range">out_of_range</a></code> exception can be caught.,<aclass="el"href="classnlohmann_1_1detail_1_1out__of__range.html"title="exception indicating access out of the defined range">out_of_range</a>}</p>
<dlclass="section see"><dt>See also</dt><dd>- <aclass="el"href="classnlohmann_1_1detail_1_1exception.html">exception</a> for the base class of the library exceptions </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1parse__error.html">parse_error</a> for exceptions indicating a parse error </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1invalid__iterator.html">invalid_iterator</a> for exceptions indicating errors with iterators </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1type__error.html">type_error</a> for exceptions indicating executing a member function with a wrong type </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1other__error.html">other_error</a> for exceptions indicating other library errors</dd></dl>