Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Fri, 20 Apr 2012 17:37:02 -0400
changeset 554 b080658ef650
parent 553 39127a5c8af0
child 555 8d3486fd6a14
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Fri Apr 20 17:29:43 2012 -0400
+++ b/playground/jsonld.js	Fri Apr 20 17:37:02 2012 -0400
@@ -1117,9 +1117,9 @@
       // @graph must be an array or an object
       if(prop === '@graph' && !(_isObject(value) || _isArray(value))) {
         throw new JsonLdError(
-            'Invalid JSON-LD syntax; "@value" value must not be an ' +
-            'object or an array.',
-            'jsonld.SyntaxError', {value: value});
+          'Invalid JSON-LD syntax; "@value" value must not be an ' +
+          'object or an array.',
+          'jsonld.SyntaxError', {value: value});
       }
 
       // @value must not be an object or an array
@@ -1482,7 +1482,7 @@
     if(!_isObject(ctx)) {
       throw new JsonLdError(
         'Invalid JSON-LD syntax; @context must be an object.',
-        {context: ctx});
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     // define context mappings for keys in local context
@@ -2232,8 +2232,7 @@
   if(!_isArray(frame) || frame.length !== 1 || !_isObject(frame[0])) {
     throw new JsonLdError(
       'Invalid JSON-LD syntax; a JSON-LD frame must be a single object.',
-      'jsonld.SyntaxError',
-      {frame: frame});
+      'jsonld.SyntaxError', {frame: frame});
   }
 }
 
@@ -2737,13 +2736,14 @@
     if(key !== '@language') {
       throw new JsonLdError(
         'Invalid JSON-LD syntax; keywords cannot be overridden.',
-        {context: ctx});
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     if(value !== null && !_isString(value)) {
       throw new JsonLdError(
         'Invalid JSON-LD syntax; the value of "@language" in a ' +
-        '@context must be a string or null.', {context: ctx});
+        '@context must be a string or null.',
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     if(value === null) {
@@ -2801,7 +2801,8 @@
   if(!_isObject(value)) {
     throw new JsonLdError(
       'Invalid JSON-LD syntax; @context property values must be ' +
-      'strings or objects.', {context: ctx});
+      'strings or objects.',
+      'jsonld.SyntaxError', {context: ctx});
   }
 
   // create new mapping
@@ -2812,7 +2813,7 @@
     if(!_isString(id)) {
       throw new JsonLdError(
         'Invalid JSON-LD syntax; @context @id values must be strings.',
-        {context: ctx});
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     // expand @id to full IRI
@@ -2826,7 +2827,7 @@
     if(prefix === null) {
       throw new JsonLdError(
         'Invalid JSON-LD syntax; @context terms must define an @id.',
-        {context: ctx, key: key});
+        'jsonld.SyntaxError', {context: ctx, key: key});
     }
 
     // set @id based on prefix parent
@@ -2845,7 +2846,7 @@
     if(!_isString(type)) {
       throw new JsonLdError(
         'Invalid JSON-LD syntax; @context @type values must be strings.',
-        {context: ctx});
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     if(type !== '@id') {
@@ -2863,7 +2864,7 @@
       throw new JsonLdError(
         'Invalid JSON-LD syntax; @context @container value must be ' +
         '"@list" or "@set".',
-        {context: ctx});
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     // add @container to mapping
@@ -2876,7 +2877,7 @@
       throw new JsonLdError(
         'Invalid JSON-LD syntax; @context @language value must be ' +
         'a string or null.',
-        {context: ctx});
+        'jsonld.SyntaxError', {context: ctx});
     }
 
     // add @language to mapping
@@ -2965,7 +2966,8 @@
   if(!_isAbsoluteIri(value)) {
     throw new JsonLdError(
       'Invalid JSON-LD syntax; a @context value does not expand to ' +
-      'an absolute IRI.', {context: ctx, value: value});
+      'an absolute IRI.',
+      'jsonld.SyntaxError', {context: ctx, value: value});
   }
 
   return value;