mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
Discuss re-entrant errors and design
This commit is contained in:
parent
ca7c5e08c1
commit
6228b6b950
2 changed files with 18 additions and 0 deletions
|
@ -45,6 +45,21 @@ namespace nix {
|
|||
);
|
||||
}
|
||||
|
||||
TEST_F(ErrorTraceTest, NestedThrows) {
|
||||
try {
|
||||
state.error("Not much").withTrace(noPos, "No more").debugThrow<EvalError>();
|
||||
} catch (BaseError & e) {
|
||||
try {
|
||||
state.error("Not much more").debugThrow<EvalError>();
|
||||
} catch (Error & e2) {
|
||||
e.addTrace(state.positions[noPos], "Something", "");
|
||||
//e2.addTrace(state.positions[noPos], "Something", "");
|
||||
ASSERT_TRUE(e.info().traces.size() == 2);
|
||||
ASSERT_TRUE(e2.info().traces.size() == 0);
|
||||
ASSERT_FALSE(&e.info() == &e2.info());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define ASSERT_TRACE1(args, type, message) \
|
||||
ASSERT_THROW( \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue