JSONPreparse catch-all
Brought to you by:
ninja9578
Hi again,
Looking at JSONPreparse.cpp,
whenever you hit an error, you seem to always "throw false". That is fine, I suppose (it would be nicer to throw eg struct preparse_error {};),
but in JSONPrepare::isValidRoot(), you do a
} catch (...) {}
which falls through to throw std::invalid_argument()
Could I suggest instead that you do
} catch (bool) {}
(and catch anything else you might throw on purpose)
and then rethrow as invalid_argument() ?
That way, if (eg) std::bad_alloc is thrown due to lack of memory, then the program can properly detect and handle that in a different way.
Ideally, you could throw a more detailed error report rather than throwing 'false'. That way, validations aren't just yes/no results.
what do you think?
cheers,
Paul
If this is to carry the necessary doses. Bulky items should require little preparation. That's it for skiing, boating, hiking, waterskiingor other fun activity that many divorcees have themselves. <a href="http://survival-gear.info" title="camping gear">camping gear</a>