Better yet, define an mpg123::error exception that inherits from std::system_error, so exceptions from the mpg123 adapter can be distinguished from other system_error exceptions in the try-catch block.
I just noticed that you use this trick in the library (and then remembered your blog post):
include/trial/protocol/json/error.hpp:class error : public std::system_error
However, the PR for the skip algorithm I've sent previously (I was playing with json::partial::skip() lately) doesn't follow this trick and throws system_error directly:
There is a topic from your blog:
— http://breese.github.io/2017/05/12/customizing-error-codes.html
I just noticed that you use this trick in the library (and then remembered your blog post):
However, the PR for the skip algorithm I've sent previously (I was playing with
json::partial::skip()
lately) doesn't follow this trick and throwssystem_error
directly:https://github.com/breese/trial.protocol/blob/5e5c939303ad69c6db9451caa17fe37e45cc476a/include/trial/protocol/json/partial/skip.hpp#L79