@@ -263,8 +263,8 @@ try test("Closure Lifetime") {
263263 let c1Line = #line + 1
264264 let c1 = JSClosure { $0 [ 0 ] }
265265 c1. release ( )
266- let error = try expectThrow ( try evalClosure. throws ( c1, JSValue . number ( 42.0 ) ) ) as! JSValue
267- try expect ( " Error message should contains definition location " , error. description. hasSuffix ( " PrimaryTests/main.swift: \( c1Line) " ) )
266+ let error = try expectThrow ( try evalClosure. throws ( c1, JSValue . number ( 42.0 ) ) ) as! JSException
267+ try expect ( " Error message should contains definition location " , error. thrownValue . description. hasSuffix ( " PrimaryTests/main.swift: \( c1Line) " ) )
268268 }
269269#endif
270270
@@ -275,8 +275,8 @@ try test("Closure Lifetime") {
275275
276276 do {
277277 let c1 = JSClosure { _ in fatalError ( " Crash while closure evaluation " ) }
278- let error = try expectThrow ( try evalClosure. throws ( c1) ) as! JSValue
279- try expectEqual ( error. description, " RuntimeError: unreachable " )
278+ let error = try expectThrow ( try evalClosure. throws ( c1) ) as! JSException
279+ try expectEqual ( error. thrownValue . description, " RuntimeError: unreachable " )
280280 }
281281}
282282
@@ -770,32 +770,32 @@ try test("Exception") {
770770
771771 // MARK: Throwing method calls
772772 let error1 = try expectThrow ( try prop_9. object!. throwing. func1!( ) )
773- try expectEqual ( error1 is JSValue , true )
774- let errorObject = JSError ( from: error1 as! JSValue )
773+ try expectEqual ( error1 is JSException , true )
774+ let errorObject = JSError ( from: ( error1 as! JSException ) . thrownValue )
775775 try expectNotNil ( errorObject)
776776
777777 let error2 = try expectThrow ( try prop_9. object!. throwing. func2!( ) )
778- try expectEqual ( error2 is JSValue , true )
779- let errorString = try expectString ( error2 as! JSValue )
778+ try expectEqual ( error2 is JSException , true )
779+ let errorString = try expectString ( ( error2 as! JSException ) . thrownValue )
780780 try expectEqual ( errorString, " String Error " )
781781
782782 let error3 = try expectThrow ( try prop_9. object!. throwing. func3!( ) )
783- try expectEqual ( error3 is JSValue , true )
784- let errorNumber = try expectNumber ( error3 as! JSValue )
783+ try expectEqual ( error3 is JSException , true )
784+ let errorNumber = try expectNumber ( ( error3 as! JSException ) . thrownValue )
785785 try expectEqual ( errorNumber, 3.0 )
786786
787787 // MARK: Simple function calls
788788 let error4 = try expectThrow ( try prop_9. func1. function!. throws ( ) )
789- try expectEqual ( error4 is JSValue , true )
790- let errorObject2 = JSError ( from: error4 as! JSValue )
789+ try expectEqual ( error4 is JSException , true )
790+ let errorObject2 = JSError ( from: ( error4 as! JSException ) . thrownValue )
791791 try expectNotNil ( errorObject2)
792792
793793 // MARK: Throwing constructor call
794794 let Animal = JSObject . global. Animal. function!
795795 _ = try Animal . throws. new ( " Tama " , 3 , true )
796796 let ageError = try expectThrow ( try Animal . throws. new ( " Tama " , - 3 , true ) )
797- try expectEqual ( ageError is JSValue , true )
798- let errorObject3 = JSError ( from: ageError as! JSValue )
797+ try expectEqual ( ageError is JSException , true )
798+ let errorObject3 = JSError ( from: ( ageError as! JSException ) . thrownValue )
799799 try expectNotNil ( errorObject3)
800800}
801801
@@ -824,18 +824,15 @@ try test("Unhandled Exception") {
824824
825825 // MARK: Throwing method calls
826826 let error1 = try wrapUnsafeThrowableFunction { _ = prop_9. object!. func1!( ) }
827- try expectEqual ( error1 is JSValue , true )
828- let errorObject = JSError ( from: error1 as! JSValue )
827+ let errorObject = JSError ( from: error1)
829828 try expectNotNil ( errorObject)
830829
831830 let error2 = try wrapUnsafeThrowableFunction { _ = prop_9. object!. func2!( ) }
832- try expectEqual ( error2 is JSValue , true )
833- let errorString = try expectString ( error2 as! JSValue )
831+ let errorString = try expectString ( error2)
834832 try expectEqual ( errorString, " String Error " )
835833
836834 let error3 = try wrapUnsafeThrowableFunction { _ = prop_9. object!. func3!( ) }
837- try expectEqual ( error3 is JSValue , true )
838- let errorNumber = try expectNumber ( error3 as! JSValue )
835+ let errorNumber = try expectNumber ( error3)
839836 try expectEqual ( errorNumber, 3.0 )
840837}
841838
0 commit comments