From e76df38ff5da4e8881b233c62b1d5a5354687dc0 Mon Sep 17 00:00:00 2001 From: Brian Richter Date: Mon, 2 Oct 2023 15:11:02 -0700 Subject: [PATCH 1/3] Added URL to context resolution error message. --- CHANGELOG.md | 5 +++++ lib/ContextResolver.js | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a84a1d..9b1bff2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # jsonld ChangeLog +## 8.3.2 - xxxx-xx-xx + +### Added +- Added URL to context resolution error message. + ## 8.3.1 - 2023-09-06 ### Fixed diff --git a/lib/ContextResolver.js b/lib/ContextResolver.js index e70ba98a..8a3729a7 100644 --- a/lib/ContextResolver.js +++ b/lib/ContextResolver.js @@ -171,8 +171,8 @@ module.exports = class ContextResolver { } } catch(e) { throw new JsonLdError( - 'Dereferencing a URL did not result in a valid JSON-LD object. ' + - 'Possible causes are an inaccessible URL perhaps due to ' + + 'Dereferencing the URL ' + url + ' did not result in a valid JSON-LD ' + + 'object. Possible causes are an inaccessible URL perhaps due to ' + 'a same-origin policy (ensure the server uses CORS if you are ' + 'using client-side JavaScript), too many redirects, a ' + 'non-JSON response, or more than one HTTP Link Header was ' + @@ -184,8 +184,8 @@ module.exports = class ContextResolver { // ensure ctx is an object if(!_isObject(context)) { throw new JsonLdError( - 'Dereferencing a URL did not result in a JSON object. The ' + - 'response was valid JSON, but it was not a JSON object.', + 'Dereferencing the URL ' + url + ' did not result in a JSON object. ' + + 'The response was valid JSON, but it was not a JSON object.', 'jsonld.InvalidUrl', {code: 'invalid remote context', url}); } From 3cd01e57c2190157e7afd42a6df5ca7f8cb66a98 Mon Sep 17 00:00:00 2001 From: Brian Richter Date: Mon, 2 Oct 2023 15:17:34 -0700 Subject: [PATCH 2/3] Update lib/ContextResolver.js Co-authored-by: Dave Longley --- lib/ContextResolver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ContextResolver.js b/lib/ContextResolver.js index 8a3729a7..ef105da2 100644 --- a/lib/ContextResolver.js +++ b/lib/ContextResolver.js @@ -184,7 +184,7 @@ module.exports = class ContextResolver { // ensure ctx is an object if(!_isObject(context)) { throw new JsonLdError( - 'Dereferencing the URL ' + url + ' did not result in a JSON object. ' + + `Dereferencing the URL "${url}" did not result in a JSON object. ` + 'The response was valid JSON, but it was not a JSON object.', 'jsonld.InvalidUrl', {code: 'invalid remote context', url}); } From f7791d16763f39cd81c64bfd97c414105690190a Mon Sep 17 00:00:00 2001 From: Brian Richter Date: Mon, 2 Oct 2023 15:17:38 -0700 Subject: [PATCH 3/3] Update lib/ContextResolver.js Co-authored-by: Dave Longley --- lib/ContextResolver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ContextResolver.js b/lib/ContextResolver.js index ef105da2..10877b7c 100644 --- a/lib/ContextResolver.js +++ b/lib/ContextResolver.js @@ -171,7 +171,7 @@ module.exports = class ContextResolver { } } catch(e) { throw new JsonLdError( - 'Dereferencing the URL ' + url + ' did not result in a valid JSON-LD ' + + `Dereferencing the URL "${url}" did not result in a valid JSON-LD ` + 'object. Possible causes are an inaccessible URL perhaps due to ' + 'a same-origin policy (ensure the server uses CORS if you are ' + 'using client-side JavaScript), too many redirects, a ' +