Skip to content

Commit

Permalink
add more error details to the pkm sync
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Jul 9, 2024
1 parent 0dd834d commit 6bdd342
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pkm-integrations/background/backend/simple-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export class MemexLocalBackend {
syncKey: syncKey,
})

console.log('body', body)

const response = await fetch(`${this.deps.url}/update-file`, {
method: 'PUT',
headers: {
Expand All @@ -133,8 +135,11 @@ export class MemexLocalBackend {
})
}

if (!response.ok || response.status !== 200) {
throw new Error(`HTTP error! status: ${response.status}`)
if (!response.ok) {
const errorResponse = await response.json()
throw new Error(
`HTTP error! status: ${response.status}, message: ${errorResponse.error}`,
)
}
}

Expand Down

0 comments on commit 6bdd342

Please sign in to comment.