more idiomatic way to throw & catch parse errors #9
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mark/midiminder#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "packaging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It is much better to inherit from std::runtime_exception than std::string. std::string, with its non-virtual destructor, is not meant to be a base class. std::runtime_exception is designed to be a base class and contains a std::string.
Another reason for Parse to inherit from std::runtime_exception instead of std::string is that copying a std::string can throw an exception while copying a std::runtime_exception cannot. Thrown objects should be no-throw copyable. The what-string in std::runtime_exception is const and ref-counted, it is not duplicated on copy.