Skip to content

Commit

Permalink
fix(error-handling): fix incorrect error handling in template-fetcher…
Browse files Browse the repository at this point in the history
… service
  • Loading branch information
elpoelma committed Jan 6, 2025
1 parent 1c5f871 commit 02e6905
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-lizards-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': patch
---

Fix incorrect fetch error handling in template-fetcher
6 changes: 3 additions & 3 deletions app/services/template-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class TemplateFetcher extends Service {
`;

const response = await this.sendQuery(sparqlEndpoint, sparqlQuery);
if (!response.ok) {
if (response.ok) {
const json = await response.json();
const bindings = json.results.bindings;
const templates = bindings.map(this.bindingToTemplate(fileEndpoint));
Expand Down Expand Up @@ -99,7 +99,7 @@ export default class TemplateFetcher extends Service {
`;

const response = await this.sendQuery(sparqlEndpoint, sparqlQuery);
if (!response.ok) {
if (response.ok) {
const json = await response.json();
const bindings = json.results.bindings;
const templates = bindings.map(this.bindingToTemplate(fileEndpoint));
Expand Down Expand Up @@ -145,7 +145,7 @@ export default class TemplateFetcher extends Service {
ORDER BY LCASE(REPLACE(STR(?title), '^ +| +$', ''))
`;
const response = await this.sendQuery(sparqlEndpoint, sparqlQuery);
if (!response.ok) {
if (response.ok) {
const json = await response.json();
const bindings = json.results.bindings;
const templates = bindings.map(this.bindingToTemplate(fileEndpoint));
Expand Down

0 comments on commit 02e6905

Please sign in to comment.