mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[web] In _deleteV1Account
: Add response?.statusCode
optional chaining, await request before getting response (#19936)
* Add optional chaining in `response.statusCode` in `_deleteV1Account` error handling Should fix https://overleaf.sentry.io/issues/5708988236/ * Add another `response?.statusCode` * Await `V1Api.promises.request` before getting the response GitOrigin-RevId: 52a156680845516357b11943bee8c33a5a023514
This commit is contained in:
parent
019562cb5a
commit
8e68f10523
1 changed files with 6 additions and 6 deletions
|
@ -71,17 +71,17 @@ const V1Api = {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(response.statusCode >= 200 && response.statusCode < 300) ||
|
(response && response.statusCode >= 200 && response.statusCode < 300) ||
|
||||||
Array.from(options.expectedStatusCodes || []).includes(
|
Array.from(options.expectedStatusCodes || []).includes(
|
||||||
response.statusCode
|
response?.statusCode
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return callback(null, response, body)
|
return callback(null, response, body)
|
||||||
} else if (response.statusCode === 403) {
|
} else if (response?.statusCode === 403) {
|
||||||
error = new Errors.ForbiddenError('overleaf v1 returned forbidden')
|
error = new Errors.ForbiddenError('overleaf v1 returned forbidden')
|
||||||
error.statusCode = response.statusCode
|
error.statusCode = response.statusCode
|
||||||
return callback(error)
|
return callback(error)
|
||||||
} else if (response.statusCode === 404) {
|
} else if (response?.statusCode === 404) {
|
||||||
error = new Errors.NotFoundError(
|
error = new Errors.NotFoundError(
|
||||||
`overleaf v1 returned non-success code: ${response.statusCode} ${options.method} ${options.uri}`
|
`overleaf v1 returned non-success code: ${response.statusCode} ${options.method} ${options.uri}`
|
||||||
)
|
)
|
||||||
|
@ -89,9 +89,9 @@ const V1Api = {
|
||||||
return callback(error)
|
return callback(error)
|
||||||
} else {
|
} else {
|
||||||
error = new Error(
|
error = new Error(
|
||||||
`overleaf v1 returned non-success code: ${response.statusCode} ${options.method} ${options.uri}`
|
`overleaf v1 returned non-success code: ${response?.statusCode} ${options.method} ${options.uri}`
|
||||||
)
|
)
|
||||||
error.statusCode = response.statusCode
|
error.statusCode = response?.statusCode
|
||||||
return callback(error)
|
return callback(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue