Why does try\catch not work in this example?

Probably because the Plot() call does not throw. The try/catch block returns a Plot, which Julia then tries to show; that is when the exception is thrown.

I don’t know how PlotlyLight works, but it’s possible that trying Plot(y=[NaN,NaN]) |> display will throw.

5 Likes