File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 3
3
using Base. Math: nan_dom_err
4
4
5
5
struct AmosException <: Exception
6
- info:: Int32
6
+ id:: Int32
7
+ msg:: String
8
+
9
+ function AmosException (id:: Integer )
10
+ msg = if id == 0
11
+ " Normal return, computation complete."
12
+ elseif id == 1
13
+ " Input error"
14
+ elseif id == 2
15
+ " Overflow"
16
+ elseif id == 3
17
+ " Input argument magnitude large, less than half machine accuracy loss by argument reduction."
18
+ elseif id == 4
19
+ " Input argument magnitude too large, complete loss of accuracy by argument reduction."
20
+ elseif id == 5
21
+ " Algorithm termination condition not met."
22
+ else
23
+ throw (ArgumentError (" invalid AMOS error flag: $id " ))
24
+ end
25
+ new (id,msg)
26
+ end
7
27
end
28
+ Base. showerror (io:: IO , err:: AmosException ) = print (io, " AmosException with id $(err. id) : $(err. msg) " )
8
29
9
30
# # Airy functions
10
31
let
Original file line number Diff line number Diff line change 543
543
@test typeof (SF. zeta (complex (1 ,1 ), 2f0 )) == Complex{Float64}
544
544
@test typeof (SF. zeta (complex (1 ), 2.0 )) == Complex{Float64}
545
545
end
546
+
547
+ @test sprint (showerror, SF. AmosException (1 )) == " AmosException with id 1: Input error"
You can’t perform that action at this time.
0 commit comments