File size: 972 Bytes
660c0b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# [developer docs] Errors thrown in C++ test files?

Subcategory: Best practices

## Conversation

### cdleary
I presume for errors in C++ test code (e.g. fixtures and similar) it's ok to throw more "bare" errors (vs the scheme used with the logger and explicitly enumerated exceptions) -- that is, it's ok to throw a derived class from `std::runtime_error` if something goes wrong in test fixture scaffolding?

If so I'll update the developer docs with a small note, but I wanted to check this seemed ok.

CC @maliberty 

### cdleary
(Or if non-exception-code is preferred in test code, that'd be fine too, just let me know what the preferred way to fatal-error-with-message would be.)

### cdleary
(Or possibly we use logger with an error ID of 0 for a testing use cases like this?)

Apologies for the stream of conscious of possibilities. :-)

### maliberty
What do you mean by "explicitly enumerated exceptions"?  In general I'm ok with your initial statement.