Catch crop cancelled errors (#9451)
This commit is contained in:
@@ -15,6 +15,8 @@ import {openCropper} from '#/lib/media/picker'
|
||||
import {getDataUriSize} from '#/lib/media/util'
|
||||
import {useRequestNotificationsPermission} from '#/lib/notifications/notifications'
|
||||
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
||||
import {isCancelledError} from '#/lib/strings/errors'
|
||||
import {logger} from '#/logger'
|
||||
import {isNative, isWeb} from '#/platform/detection'
|
||||
import {
|
||||
DescriptionText,
|
||||
@@ -184,11 +186,17 @@ export function StepProfile() {
|
||||
if (!image) return
|
||||
|
||||
if (!isWeb) {
|
||||
image = await openCropper({
|
||||
imageUri: image.path,
|
||||
shape: 'circle',
|
||||
aspectRatio: 1 / 1,
|
||||
})
|
||||
try {
|
||||
image = await openCropper({
|
||||
imageUri: image.path,
|
||||
shape: 'circle',
|
||||
aspectRatio: 1 / 1,
|
||||
})
|
||||
} catch (e) {
|
||||
if (!isCancelledError(e)) {
|
||||
logger.error('Failed to crop avatar in onboarding', {error: e})
|
||||
}
|
||||
}
|
||||
}
|
||||
image = await compressIfNeeded(image, 1000000)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user