Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding std::exception translation #498

Closed
wants to merge 1 commit into from
Closed

Allow overriding std::exception translation #498

wants to merge 1 commit into from

Conversation

mikedld
Copy link

@mikedld mikedld commented Sep 16, 2015

CATCH_TRANSLATE_EXCEPTION allows to only translate exceptions which are
not inherited from std::exception (as well as std::string and char*).
There're exception classes though which inherit from std::exception but
don't provide any meaningful info as what() result, Poco::Exception being
one of those. In this case, adding translator like

    CATCH_TRANSLATE_EXCEPTION(Poco::Exception const& e)
    {
        return e.displayText();
    }

might help, but unfortunately it's not functioning as desired.

This commit makes it possible to provide translation overrides for
std::exception-derived classes.

CATCH_TRANSLATE_EXCEPTION allows to only translate exceptions which are
not inherited from std::exception (as well as std::string and char*).
There're exception classes though which inherit from std::exception but
don't provide any meaningful info as what() result, Poco::Exception being
one of those. In this case, adding translator like
    CATCH_TRANSLATE_EXCEPTION(Poco::Exception const& e)
    {
        return e.displayText();
    }
might help, but unfortunately it's not functioning as desired.

This commit makes it possible to provide translation overrides for
std::exception-derived classes.
@philsquared philsquared closed this Dec 9, 2015
@mikedld
Copy link
Author

mikedld commented Dec 9, 2015

Sorry, was the closing a silent "no"?..

@nabijaczleweli
Copy link
Contributor

Looks like @philsquared just mass-closed 16 issues, probably either he's cleaning up or he fucked up on using a bot or summat.

@philsquared
Copy link
Collaborator

I deleted the develop branch (which is now fully merged into master).
It hadn't occurred to me that would automatically close all PRs against the branch. Makes sense, though.

I'm going to have to go back over them now and see which need reopening - probably not a bad thing as I'm behind anyway.

In the case of this one, though, I believe I committed a changed fairly recently that has the same effect. Sorry this PR slipped past my radar at the time or I would have used it/ acknowledged it.

I'd appreciate if you could check out the latest master and see if it works for you translating Poco exceptions (etc).

@mikedld
Copy link
Author

mikedld commented Dec 9, 2015

Indeed it looks like a49f088 does what I need. I'll delete the branch once I confirm master works here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants