Skip to content

Commit 61c7b54

Browse files
Stop replacing MethodErrors with ErrorExceptions
1 parent 049695a commit 61c7b54

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/differentials.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ struct Wirtinger{P,C} <: AbstractDifferential
6767
conjugate::Union{Number,AbstractDifferential})
6868
return new{typeof(primal),typeof(conjugate)}(primal, conjugate)
6969
end
70-
function Wirtinger(primal, conjugate)
71-
error("`Wirtinger` only supports elements of type <: Union{Number,AbstractDifferential} for now")
72-
end
7370
end
7471

7572
wirtinger_primal(x::Wirtinger) = x.primal
@@ -86,7 +83,8 @@ Base.Broadcast.broadcastable(w::Wirtinger) = Wirtinger(broadcastable(w.primal),
8683
Base.iterate(x::Wirtinger) = (x, nothing)
8784
Base.iterate(::Wirtinger, ::Any) = nothing
8885

89-
Base.conj(x::Wirtinger) = error("`conj(::Wirtinger)` not yet defined")
86+
# TODO: define `conj` for` `Wirtinger`
87+
Base.conj(x::Wirtinger) = throw(MethodError(conj, x))
9088

9189

9290
#####

test/differentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@test x === w
1717
end
1818
@test broadcastable(w) == w
19-
@test_throws ErrorException conj(w)
19+
@test_throws MethodError conj(w)
2020
end
2121
@testset "Zero" begin
2222
z = Zero()

0 commit comments

Comments
 (0)