catchorg / catchorg/Catch2

Want to know exception type when an exception is thrown.

Open
#539 13 comments 0 reactions 0 assignees View on GitHub
Feature Request
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

Thanks in advance. I love Catch.

I generally try to make numerous exceptions with useful names such as `NumberIsWayTooBig()`. These inherit directly from std::exception:

```
class NumberIsWayTooBig : public std::exception() {};
```

When such an exception is thrown in a Catch test, I get a message:

```
FAILED:
due to unexpected exception with message:
std::exception
```

I then have to write the test in a non-Catch test file to get the type of the exception object as I would normally expect it:

```
terminate called after throwing an instance of 'NumberIsWayTooBig'
what(): std::exception
```

Is there any way to get the type of the particular exception object?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.