Skip to content

Commit 7d3d184

Browse files
committed
Throw Exceptions in Asserts
Fix #1348: Set AMReX `system::throw_exception` so that in interactive usage we can potentially catch an exception and handle it, instead of terminating the process (Python interpreter).
1 parent 7a839d9 commit 7d3d184

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/initialization/InitParser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ namespace impactx::initialization
1818
{
1919
amrex::ParmParse pp_amrex("amrex");
2020

21+
// throw exceptions in asserts, to enable optional error handling, especially in Python
22+
// https://amrex-codes.github.io/amrex/docs_html/RuntimeParameters.html#amrex.throw_exception
23+
bool throw_exception = true; // AMReX' default: false
24+
pp_amrex.queryAdd("throw_exception", throw_exception);
25+
2126
// https://amrex-codes.github.io/amrex/docs_html/GPU.html#inputs-parameters
2227
bool abort_on_out_of_gpu_memory = true; // AMReX' default: false
2328
pp_amrex.queryAdd("abort_on_out_of_gpu_memory", abort_on_out_of_gpu_memory);

0 commit comments

Comments
 (0)