PR comments.
This commit is contained in:
parent
deca999183
commit
c1e9bc3c81
|
@ -1,9 +1,14 @@
|
|||
export function is409Error(error: any) {
|
||||
export function checkErrorCode(error: any, code: number) {
|
||||
const stringCode = code.toString()
|
||||
if (typeof error === "object") {
|
||||
return error.status === 409 || error.message?.includes("409")
|
||||
return error.status === code || error.message?.includes(stringCode)
|
||||
} else if (typeof error === "number") {
|
||||
return error === 409
|
||||
return error === code
|
||||
} else if (typeof error === "string") {
|
||||
return error.includes("409")
|
||||
return error.includes(stringCode)
|
||||
}
|
||||
}
|
||||
|
||||
export function isDocumentConflictError(error: any) {
|
||||
return checkErrorCode(error, 409)
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ export async function syncUsersToAllApps(userIds: string[]) {
|
|||
const failed = resp.filter(promise => promise.status === "rejected")
|
||||
const reasons = failed
|
||||
.map(fail => (fail as PromiseRejectedResult).reason)
|
||||
.filter(reason => !dbCore.is409Error(reason))
|
||||
.filter(reason => !dbCore.isDocumentConflictError(reason))
|
||||
if (reasons.length > 0) {
|
||||
logging.logWarn("Failed to sync users to apps", reasons)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue