Skip to content

Commit

Permalink
Handle authentication errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Feb 2, 2021
1 parent 774c1be commit ebeb96d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ export class GraphDbDataStore implements Store {
method: 'POST',
headers: {'X-Graphdb-Password': this.password!},
});

if (!response.ok) {
throw Error(
'Could not authenticate username ' +
this.username +
' with GraphDB; got status code ' +
response.status
);
}

this.token = response.headers.get('Authorization')!;

return new Headers({Authorization: this.token});
Expand Down

0 comments on commit ebeb96d

Please sign in to comment.