Skip to content

Commit

Permalink
fix: include R2 key in error message (#2326)
Browse files Browse the repository at this point in the history
Include the R2 key in the error message for better visibility when
debugging.

We're getting rate limits for put with the same key...
  • Loading branch information
Alan Shaw authored Feb 22, 2023
1 parent aaee05d commit b8d0f98
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/api/src/utils/uploader/r2-uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class R2Uploader {
return { key, url }
} catch (cause) {
// @ts-expect-error wen ts understand Error object?
throw new Error('Failed to upload CAR to R2', { cause })
throw new Error(`Failed to upload CAR to R2: ${key}`, { cause })
}
}

Expand All @@ -74,7 +74,7 @@ export class R2Uploader {
})
} catch (cause) {
// @ts-expect-error error.cause is legit.
throw new Error('Failed to write satnav index to R2', { cause })
throw new Error(`Failed to write satnav index to R2: ${key}`, { cause })
}
}

Expand All @@ -91,7 +91,9 @@ export class R2Uploader {
})
} catch (cause) {
// @ts-expect-error error.cause is legit.
throw new Error('Failed to write dudewhere index to R2', { cause })
throw new Error(`Failed to write dudewhere index to R2: ${key}`, {
cause,
})
}
}
}

0 comments on commit b8d0f98

Please sign in to comment.