unity::Exception's what() implementation makes debugging difficult
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:
what(): unity::
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
- James Henstridge: Approve
- PS Jenkins bot (community): Approve (continuous-integration)
- Jussi Pakkanen (community): Needs Fixing
- Michal Hruby (community): Needs Fixing
-
Diff: 1305 lines (+272/-626)11 files modifiedCMakeLists.txt (+1/-1)
debian/changelog (+6/-0)
include/unity/Exception.h (+9/-15)
include/unity/ExceptionImplBase.h (+0/-67)
include/unity/UnityExceptions.h (+2/-41)
src/unity/CMakeLists.txt (+0/-1)
src/unity/Exception.cpp (+221/-21)
src/unity/ExceptionImplBase.cpp (+0/-296)
src/unity/UnityExceptions.cpp (+10/-71)
test/gtest/unity/Exceptions_test.cpp (+22/-112)
test/gtest/unity/util/FileIO/FileIO_test.cpp (+1/-1)
- James Henstridge: Approve
- PS Jenkins bot (community): Approve (continuous-integration)
-
Diff: 472 lines (+37/-101)11 files modifiedinclude/scopes/ScopeExceptions.h (+1/-31)
src/ScopeExceptions.cpp (+6/-38)
src/internal/QueryObject.cpp (+3/-3)
src/internal/ReplyObject.cpp (+9/-3)
src/internal/RuntimeImpl.cpp (+4/-1)
src/internal/ScopeImpl.cpp (+4/-1)
src/internal/ScopeLoader.cpp (+3/-4)
src/internal/ScopeObject.cpp (+4/-1)
src/internal/zmq_middleware/ObjectAdapter.cpp (+0/-12)
src/internal/zmq_middleware/ServantBase.cpp (+0/-4)
test/gtest/scopes/ScopeExceptions/ScopeExceptions_test.cpp (+3/-3)
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 |
Changed in unity-api: | |
status: | Fix Committed → Fix Released |
Changed in unity-scopes-api: | |
status: | Fix Committed → Fix Released |
Yes, agree. I'll make the change.