Skip to content

Commit 8f38db0

Browse files
authored
Update check.jl
1 parent 3c6fc3a commit 8f38db0

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/check.jl

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,23 @@ To throw an error if any warnings occur inside any functions, set
2525
`nowarn=:all`.
2626
2727
To throw an error if any warnings occur inside any functions EXCEPT for a
28-
certain set of functions, set `nowarn=:allexcept` and list the exceptions in
29-
the `except` variable, i.e. set `except=[f, g, h, ...]`
28+
certain set of functions, list the exceptions in the `except` variable,
29+
for example `except=[f,g,h]`
3030
"""
3131
function check(f; nowarn=Any[], except=Any[], kwargs...)
32-
if nowarn isa Symbol
32+
if !isempty(except) # if `except` is provided, we ignore the value of `nowarn`
3333
_nowarn = Any[]
34-
if nowarn == :all
35-
_nowarn_all = true
36-
_nowarn_allexcept = false
37-
elseif nowarn == :allexcept
38-
_nowarn_all = false
39-
_nowarn_allexcept = true
40-
else
41-
throw(ArgumentError(":$(nowarn) is not a valid value for nowarn"))
42-
end
34+
_nowarn_all = false
35+
_nowarn_allexcept = true
36+
elseif nowarn isa Symbol
37+
_nowarn = Any[]
38+
_nowarn_all = nowarn == :all
39+
_nowarn_allexcept = false
4340
else
4441
_nowarn = nowarn
4542
_nowarn_all = false
4643
_nowarn_allexcept = false
47-
end
44+
end
4845
failed = false
4946
wp = warning_printer()
5047
result = trace(f; kwargs...) do warning
@@ -73,8 +70,8 @@ To throw an error if any warnings occur inside any functions, set
7370
`nowarn=:all`.
7471
7572
To throw an error if any warnings occur inside any functions EXCEPT for a
76-
certain set of functions, set `nowarn=:allexcept` and list the exceptions in
77-
the `except` variable, i.e. set `except=[f, g, h, ...]`
73+
certain set of functions, list the exceptions in the `except` variable,
74+
for example `except=[f,g,h]`
7875
"""
7976
macro check(expr, args...)
8077
quote

0 commit comments

Comments
 (0)