chore(objectloader): add details to error for fetch (#5031)

This commit is contained in:
Iain Sproat
2025-07-03 13:42:45 +01:00
committed by GitHub
parent 318c728516
commit 6522260fdd
+8 -2
View File
@@ -614,10 +614,16 @@ class ObjectLoader {
const response = await this.fetch(this.requestUrlRootObj, { headers: this.headers })
if (!response.ok) {
if ([401, 403].includes(response.status)) {
throw new ObjectLoaderRuntimeError('You do not have access to the root object!')
throw new ObjectLoaderRuntimeError(
`You do not have access to the root object! Object URI: '${
this.requestUrlRootObj
}', Token ID: '${this.token.substring(0, 10)}'. Response: '${
response.status
} ${response.statusText}'`
)
}
throw new ObjectLoaderRuntimeError(
`Failed to fetch root object: ${response.status} ${response.statusText})`
`Failed to fetch root object. Object URI: '${this.requestUrlRootObj}'. Response: '${response.status} ${response.statusText}'`
)
}
const responseText = await response.text()