Comparing version 0.0.50 to 0.0.51
@@ -102,21 +102,36 @@ /** | ||
// input is RDFa | ||
jsdom.env(data, function(errors, window) { | ||
if(errors && errors.length > 0) { | ||
return callback({ | ||
message: 'DOM Errors:', | ||
errors: errors, | ||
url: loc | ||
}); | ||
} | ||
try { | ||
jsdom.env(data, function(errors, window) { | ||
if(errors && errors.length > 0) { | ||
return callback({ | ||
message: 'DOM Errors:', | ||
errors: errors, | ||
url: loc | ||
}); | ||
} | ||
try { | ||
// extract JSON-LD from RDFa | ||
RDFa.attach(window.document); | ||
jsonld.fromRDF(window.document.data, | ||
{format: 'rdfa-api'}, callback); | ||
} | ||
catch(ex) { | ||
callback(ex); | ||
} | ||
}); | ||
try { | ||
// extract JSON-LD from RDFa | ||
RDFa.attach(window.document); | ||
jsonld.fromRDF(window.document.data, | ||
{format: 'rdfa-api'}, callback); | ||
} | ||
catch(ex) { | ||
// FIXME: expose RDFa/jsonld ex? | ||
callback({ | ||
message: 'RDFa extraction error.', | ||
contentType: type, | ||
url: loc | ||
}); | ||
} | ||
}); | ||
} | ||
catch(ex) { | ||
// FIXME: expose jsdom(?) ex? | ||
callback({ | ||
message: 'jsdom error.', | ||
contentType: type, | ||
url: loc | ||
}); | ||
} | ||
break; | ||
@@ -255,7 +270,21 @@ default: | ||
if(!(res.statusCode >= 200 && res.statusCode < 300)) { | ||
return callback({ | ||
var msg = { | ||
message: 'Bad status code.', | ||
statusCode: res.statusCode, | ||
url: loc | ||
}); | ||
url: loc, | ||
}; | ||
if(body) { | ||
// attempt to auto-parse error body | ||
return _parse(loc, null, body, function(err, data) { | ||
if(err) { | ||
// failed to parse, just use raw body | ||
data = body | ||
} | ||
msg.body = data | ||
callback(msg); | ||
}); | ||
} | ||
else { | ||
return callback(msg); | ||
} | ||
} | ||
@@ -262,0 +291,0 @@ // done if length specified and is 0 |
{ | ||
"name": "jsonld", | ||
"version": "0.0.50", | ||
"version": "0.0.51", | ||
"description": "A JSON-LD Processor and API implementation in JavaScript.", | ||
@@ -29,3 +29,3 @@ "homepage": "http://github.com/digitalbazaar/jsonld.js", | ||
"pkginfo": "~0.2.3", | ||
"request": "~2.16.0", | ||
"request": "git://github.com/mikeal/request.git", | ||
"xmldom": "" | ||
@@ -32,0 +32,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279715
7775