|
@@ -87,9 +87,11 @@ static bool break_on_trap( hl_thread_info *t, hl_trap_ctx *trap, vdynamic *v ) {
|
|
|
HL_PRIM void hl_throw( vdynamic *v ) {
|
|
|
hl_thread_info *t = hl_get_thread();
|
|
|
hl_trap_ctx *trap = t->trap_current;
|
|
|
- if( t->exc_flags & HL_EXC_RETHROW )
|
|
|
+ bool was_rethrow = false;
|
|
|
+ if( t->exc_flags & HL_EXC_RETHROW ) {
|
|
|
+ was_rethrow = true;
|
|
|
t->exc_flags &= ~HL_EXC_RETHROW;
|
|
|
- else
|
|
|
+ } else
|
|
|
t->exc_stack_count = capture_stack_func(t->exc_stack_trace, HL_EXC_MAX_STACK);
|
|
|
t->exc_value = v;
|
|
|
t->trap_current = trap->prev;
|
|
@@ -98,7 +100,7 @@ HL_PRIM void hl_throw( vdynamic *v ) {
|
|
|
t->exc_flags |= HL_EXC_IS_THROW;
|
|
|
hl_debug_break();
|
|
|
t->exc_flags &= ~HL_EXC_IS_THROW;
|
|
|
- if( t->exc_handler ) hl_dyn_call(t->exc_handler,&v,1);
|
|
|
+ if( t->exc_handler && !was_rethrow ) hl_dyn_call(t->exc_handler,&v,1);
|
|
|
}
|
|
|
if( throw_jump == NULL ) throw_jump = longjmp;
|
|
|
throw_jump(trap->buf,1);
|