@@ -8,7 +8,7 @@ var untilde = function(str) {
88 case "~1" :
99 return "/" ;
1010 }
11- throw ( "Invalid tilde escape: " + m ) ;
11+ throw new Error ( "Invalid tilde escape: " + m ) ;
1212 } ) ;
1313}
1414
@@ -38,21 +38,21 @@ var traverse = function(obj, pointer, value) {
3838
3939var validate_input = function ( obj , pointer ) {
4040 if ( typeof obj !== "object" ) {
41- throw ( "Invalid input object." ) ;
41+ throw new Error ( "Invalid input object." ) ;
4242 }
4343
4444 if ( pointer === "" ) {
4545 return [ ] ;
4646 }
4747
4848 if ( ! pointer ) {
49- throw ( "Invalid JSON pointer." ) ;
49+ throw new Error ( "Invalid JSON pointer." ) ;
5050 }
5151
5252 pointer = pointer . split ( "/" ) ;
5353 var first = pointer . shift ( ) ;
5454 if ( first !== "" ) {
55- throw ( "Invalid JSON pointer." ) ;
55+ throw new Error ( "Invalid JSON pointer." ) ;
5656 }
5757
5858 return pointer ;
@@ -69,7 +69,7 @@ var get = function(obj, pointer) {
6969var set = function ( obj , pointer , value ) {
7070 pointer = validate_input ( obj , pointer ) ;
7171 if ( pointer . length === 0 ) {
72- throw ( "Invalid JSON pointer for set." )
72+ throw new Error ( "Invalid JSON pointer for set." )
7373 }
7474 return traverse ( obj , pointer , value ) ;
7575}
0 commit comments