Skip to content

Commit f2a6789

Browse files
Add error handling for unavailable plotting libraries in plot_wigner function
1 parent 3429e7b commit f2a6789

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/visualization.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ plot_wigner(
2525
kwargs...,
2626
) where {T,OpType<:Union{BraQuantumObject,KetQuantumObject,OperatorQuantumObject}} =
2727
plot_wigner(makeVal(library), state; kwargs...)
28+
29+
plot_wigner(
30+
::Val{T},
31+
state::QuantumObject{<:AbstractArray{T1},OpType};
32+
kwargs...,
33+
) where {T,T1,OpType<:Union{BraQuantumObject,KetQuantumObject,OperatorQuantumObject}} = throw(
34+
ArgumentError(
35+
"The specified plotting library $T is not available. Try running `using $T` first.",
36+
),
37+
)

0 commit comments

Comments
 (0)