Skip to content

Commit

Permalink
Log URL of failed Neucore requests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-johnson committed Jul 25, 2022
1 parent 05f63dd commit 54ff874
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/backend/src/neucore/neucore-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export class NeucoreError extends Error {
export class NeucoreResponseError extends NeucoreError {
constructor(
message: string,
path: string,
public readonly response: Response,
underlyingError?: Error
) {
super(message, underlyingError)
super(message + ` (while fetching ${path})`, underlyingError)
}
}

Expand Down Expand Up @@ -64,13 +65,15 @@ export class NeucoreClient {
} catch (error) {
throw new NeucoreResponseError(
'Failed to parse response',
path,
response,
error
)
}
}
throw new NeucoreResponseError(
`Received unexpected status code: ${response.status}`,
path,
response
)
}
Expand Down

0 comments on commit 54ff874

Please sign in to comment.