rspec/rules/S3696/description.adoc
Arseniy Zaostrovnykh 7ca29f686f Force linebreaks
2021-02-02 15:02:10 +01:00

11 lines
836 B
Plaintext

Just because you _can_ stick your hand in a blender, that doesn't mean you _should_. Similarly, you _can_ ``++throw++`` anything, but that doesn't mean you _should_ ``++throw++`` something that's not derived at some level from ``++std::exception++``.
If you can't find an existing exception type that suitably conveys what you need to convey, then you should extend ``++std::exception++`` to create one.
Specifically, part of the point of throwing exceptions is to communicate about the conditions of the error, but primitives have far less ability to communicate meaningfully than ``++exception++``s. And, the creation of some other object type could itself ``++throw++`` an exception, resulting in program termination.
Further, ``++catch++``ing non-exception types is painful and fraught with the potential for (further) error.