diff --git a/src/core.js b/src/core.js index 62141b986..969c7eeba 100644 --- a/src/core.js +++ b/src/core.js @@ -531,7 +531,7 @@ jQuery.extend({ }, error: function( msg ) { - throw msg; + throw new Error( msg ); }, parseJSON: function( data ) { diff --git a/test/unit/core.js b/test/unit/core.js index dc909546b..24da8db6c 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1129,7 +1129,7 @@ test("jQuery.parseXML", 4, function(){ xml = jQuery.parseXML( "

Not a <well-formed xml string

" ); ok( false, "invalid xml not detected" ); } catch( e ) { - strictEqual( e, "Invalid XML:

Not a <well-formed xml string

", "invalid xml detected" ); + strictEqual( e.message, "Invalid XML:

Not a <well-formed xml string

", "invalid xml detected" ); } });