[Console] Fixed exception rendering

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9045
| License       | MIT
| Doc PR        | n/a

When an exception message contains styles, the output is not the expected one. This PR addresses this issue.