Skip to content

Commit

Permalink
Fix type errors in NeucoreClient
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-johnson committed Sep 5, 2023
1 parent 50283ea commit b77b7c0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/backend/src/neucore/neucore-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ export class NeucoreClient {
/** Performs a GET request to Neucore */
private async get<T>(path: string): Promise<T> {
let response: Response
const url = `${this.baseUrl}${path}`
try {
response = await fetch(`${this.baseUrl}${path}`, {
response = await fetch(url, {
headers: this.authHeaders,
})
} catch (error) {
throw new NeucoreError('Request failed', error)
throw new NeucoreError(
`Request failed (GET ${url})`,
error instanceof Error ? error : new Error(String(error))
)
}
if (response.status < 400) {
try {
Expand All @@ -67,7 +71,7 @@ export class NeucoreClient {
'Failed to parse response',
path,
response,
error
error instanceof Error ? error : new Error(String(error))
)
}
}
Expand Down

0 comments on commit b77b7c0

Please sign in to comment.