MCPcopy Create free account
hub / github.com/boostorg/leaf / compute_answer_throws

Function compute_answer_throws

example/exception_to_result.cpp:21–30  ·  view source on GitHub ↗

Lower-level library function which throws exceptions.

Source from the content-addressed store, hash-verified

19
20// Lower-level library function which throws exceptions.
21int compute_answer_throws()
22{
23 switch( rand()%4 )
24 {
25 default: return 42;
26 case 1: throw error_a();
27 case 2: throw error_b();
28 case 3: throw error_c();
29 }
30}
31
32
33// Call compute_answer_throws, switch to result<int> for error handling.

Callers 1

compute_answerFunction · 0.85

Calls 3

error_aClass · 0.85
error_bClass · 0.85
error_cClass · 0.85

Tested by

no test coverage detected