unity::Exception's what() implementation makes debugging difficult

Bug #1260149 reported by James Henstridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Unity API
Fix Released
Undecided
Michi Henning
unity-scopes-api
Fix Released
Undecided
Michi Henning

Bug Description

unity::Exception says that subclasses should implement what() such that it returns the name of the exception, which means that code that prints exceptions without using the special to_string() method omits the reason string.

For example, an uncaught exception from a GTest test will display as:

    terminate called after throwing an instance of 'unity::api::scopes::MiddlewareException'
      what(): unity::api::scopes::MiddlewareException

Is there any reason why we couldn't have unity::Exception implement what() to return the "reason" string, and not have subclasses override it? The docs say that the return value of what() is only required to be valid while the exception is valid, so using reason_.c_str() should be safe.

Related branches

Revision history for this message
Michi Henning (michihenning) wrote :

Yes, agree. I'll make the change.

Changed in unity-api:
assignee: nobody → Michi Henning (michihenning)
status: New → In Progress
Changed in unity-scopes-api:
assignee: nobody → Michi Henning (michihenning)
Changed in unity-scopes-api:
status: New → In Progress
Changed in unity-api:
status: In Progress → Fix Committed
Changed in unity-scopes-api:
status: In Progress → Fix Committed
Michal Hruby (mhr3)
Changed in unity-api:
status: Fix Committed → Fix Released
Changed in unity-scopes-api:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.