# Why is the exception not rethrown in logging?

**URL:** <https://discourse.julialang.org/t/why-is-the-exception-not-rethrown-in-logging/60658>\
**Category:** Internals & Design\
**Created:** [May 6, 2021, 2:45pm UTC](https://discourse.julialang.org/t/why-is-the-exception-not-rethrown-in-logging/60658 "2021-05-06T14:45:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![findmyway](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/findmyway/32/4946_2.png) [@findmyway](https://discourse.julialang.org/u/findmyway)\
**Post date:** [May 6, 2021, 2:45pm UTC](https://discourse.julialang.org/t/why-is-the-exception-not-rethrown-in-logging/60658/1 "2021-05-06T14:45:22Z")

</div>

[https://github.com/JuliaLang/julia/blob/ae1aa16bc0ee608568d799e25620ba9580110f9b/base/logging.jl#L339-L346](https://github.com/JuliaLang/julia/blob/ae1aa16bc0ee608568d799e25620ba9580110f9b/base/logging.jl#L339-L346)

Can anyone explain why the exception is not rethrown here?

We find that this will create something inconsistent in tests. See discussions here: [https://github.com/JuliaReinforcementLearning/ReinforcementLearning.jl/pull/263#issuecomment-833566441](https://github.com/JuliaReinforcementLearning/ReinforcementLearning.jl/pull/263#issuecomment-833566441)

For example:

```julia
@testset "test" begin
    a = error("abc")
    @info "testing..." a
end

```

This will result in a report with an error:

```julia
Test Summary: | Error Total
test | 1 1
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /mnt/E4E0A9C0E0A998F6/github/test_flux/abc/test/runtests.jl:3
ERROR: Package abc errored during testing

```

While the following one will not (just the same with the one in our tests):

```julia
using Test

@testset "test" begin
    @info "testing..." a = error("abc")
end

```

```julia
     Testing Running tests...
Test Summary: |
test | No tests
     Testing abc tests passed 

```
