1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

chore(edit-context): add error handling for fetch

This commit is contained in:
Krishna Acondy
2020-09-10 09:30:56 +01:00
parent 9b0e02f5b7
commit c43c9ec211

View File

@@ -302,7 +302,18 @@ export class SASViyaApiClient {
{
headers
}
)
).catch((e) => {
console.error(e)
if (e && e.status === 404) {
throw new Error(
`The context with ID ${contextId} was not found on this server.`
)
}
throw new Error(
`An error occurred when fetching the context with ID ${contextId}`
)
})
// An If-Match header with the value of the last ETag for the context
// is required to be able to update it