Skip to content

Commit 9b20515

Browse files
committed
fix: transactions execution failure should lead to json "succes: false"
1 parent 3aa59bb commit 9b20515

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libmamba/src/core/transaction.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,16 @@ namespace mamba
368368
bool
369369
MTransaction::execute(const Context& ctx, ChannelContext& channel_context, PrefixData& prefix)
370370
{
371+
on_scope_exit _fail_json_if_exception{
372+
[]
373+
{
374+
if (std::uncaught_exceptions() > 0)
375+
{
376+
Console::instance().json_write({ { "success", false } });
377+
}
378+
}
379+
};
380+
371381
// JSON output
372382
// back to the top level if any action was required
373383
if (!empty())

0 commit comments

Comments
 (0)