Skip to content

Commit c641f7b

Browse files
Throw ArgumentErrors where appropriate
1 parent 61c7b54 commit c641f7b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/differentials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ wirtinger_primal(x) = x
7575
wirtinger_conjugate(x::Wirtinger) = x.conjugate
7676
wirtinger_conjugate(::Any) = Zero()
7777

78-
extern(x::Wirtinger) = error("`Wirtinger` cannot be converted into an external type.")
78+
extern(x::Wirtinger) = throw(ArgumentError("`Wirtinger` cannot be converted to an external type."))
7979

8080
Base.Broadcast.broadcastable(w::Wirtinger) = Wirtinger(broadcastable(w.primal),
8181
broadcastable(w.conjugate))
@@ -145,7 +145,7 @@ is not defined.
145145
"""
146146
struct DNE <: AbstractDifferential end
147147

148-
extern(x::DNE) = error("`DNE` cannot be converted into an external type.")
148+
extern(x::DNE) = throw(ArgumentError("`DNE` cannot be converted to an external type."))
149149

150150
Base.Broadcast.broadcastable(::DNE) = Ref(DNE())
151151

test/differentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# TODO: other + methods stack overflow
1313
@test_throws ErrorException w*w
14-
@test_throws ErrorException extern(w)
14+
@test_throws ArgumentError extern(w)
1515
for x in w
1616
@test x === w
1717
end

0 commit comments

Comments
 (0)