📝 overworked documentation

Replacing references to std exceptions with user-defined exceptions.
Also changed some examples to the new exceptions.
parent 9374eaa0
......@@ -26,8 +26,8 @@ int main()
{
object.at("the fast") = "il rapido";
}
catch (std::out_of_range& e)
catch (json::out_of_range& e)
{
std::cout << "out of range: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
}
<a target="_blank" href="http://melpon.org/wandbox/permlink/tb5CaFfsMWpAvi7m"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/WtZ49NXtkzcLAx37"><b>online</b></a>
\ No newline at end of file
"il brutto"
{"the bad":"il cattivo","the good":"il buono","the ugly":"il brutto"}
out of range: key 'the fast' not found
[json.exception.out_of_range.403] key 'the fast' not found
"il brutto"
{"the bad":"il cattivo","the good":"il buono","the ugly":"il brutto"}
[json.exception.out_of_range.403] key 'the fast' not found
......@@ -20,7 +20,7 @@ int main()
{
std::cout << object.at("the fast") << '\n';
}
catch (std::out_of_range)
catch (json::out_of_range)
{
std::cout << "out of range" << '\n';
}
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/NFG86H5khRUePc1s"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/AsC3grSJ7UngjKwF"><b>online</b></a>
\ No newline at end of file
......@@ -21,8 +21,8 @@ int main()
{
array.at(5) = "sixth";
}
catch (std::out_of_range& e)
catch (json::out_of_range& e)
{
std::cout << "out of range: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
}
<a target="_blank" href="http://melpon.org/wandbox/permlink/R7z2SB2rMdFQ9XtR"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/EU0DspVPybW5cJDH"><b>online</b></a>
\ No newline at end of file
"third"
["first","second","third","fourth"]
out of range: array index 5 is out of range
[json.exception.out_of_range.401] array index 5 is out of range
......@@ -15,7 +15,7 @@ int main()
{
std::cout << array.at(5) << '\n';
}
catch (std::out_of_range)
catch (json::out_of_range)
{
std::cout << "out of range" << '\n';
}
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/L1bMeiN6nYm7JrvA"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/ZiPo8P49B2Cc8B85"><b>online</b></a>
\ No newline at end of file
......@@ -19,7 +19,7 @@ int main()
{
auto r3 = value.get_ref<json::number_float_t&>();
}
catch (std::domain_error& ex)
catch (json::type_error& ex)
{
std::cout << ex.what() << '\n';
}
......
<a target="_blank" href="http://melpon.org/wandbox/permlink/WiO1oBWDvIs82OX1"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/lsl8Ex3d3SOYnKHu"><b>online</b></a>
\ No newline at end of file
17 17
incompatible ReferenceType for get_ref, actual type is number
[json.exception.type_error.303] incompatible ReferenceType for get_ref, actual type is number
17 17
[json.exception.type_error.303] incompatible ReferenceType for get_ref, actual type is number
......@@ -19,9 +19,9 @@ int main()
{
json::json_pointer p9("foo");
}
catch (std::domain_error& e)
catch (json::parse_error& e)
{
std::cout << "domain_error: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
// error: JSON pointer uses escape symbol ~ not followed by 0 or 1
......@@ -29,9 +29,9 @@ int main()
{
json::json_pointer p10("/foo/~");
}
catch (std::domain_error& e)
catch (json::parse_error& e)
{
std::cout << "domain_error: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
// error: JSON pointer uses escape symbol ~ not followed by 0 or 1
......@@ -39,8 +39,8 @@ int main()
{
json::json_pointer p11("/foo/~3");
}
catch (std::domain_error& e)
catch (json::parse_error& e)
{
std::cout << "domain_error: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
}
<a target="_blank" href="http://melpon.org/wandbox/permlink/WM2WWKnXdmdw17Wu"><b>online</b></a>
\ No newline at end of file
<a target="_blank" href="http://melpon.org/wandbox/permlink/Wlvqfd3JpEXTv2iH"><b>online</b></a>
\ No newline at end of file
domain_error: JSON pointer must be empty or begin with '/'
domain_error: escape error: '~' must be followed with '0' or '1'
domain_error: escape error: '~' must be followed with '0' or '1'
[json.exception.parse_error.107] parse error at 1: JSON pointer must be empty or begin with '/' - was: 'foo'
[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'
[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'
[json.exception.parse_error.107] parse error at 1: JSON pointer must be empty or begin with '/' - was: 'foo'
[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'
[json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment