From 31ac342b80ff8ee930073bcc9ce8622a45b5e53f Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 13 Apr 2021 12:21:57 +0200 Subject: [PATCH] MOBILE-3496 core: Fix treating number errors in camera --- .../features/fileuploader/services/fileuploader-helper.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/features/fileuploader/services/fileuploader-helper.ts b/src/core/features/fileuploader/services/fileuploader-helper.ts index e0e939f57..6a159e0fc 100644 --- a/src/core/features/fileuploader/services/fileuploader-helper.ts +++ b/src/core/features/fileuploader/services/fileuploader-helper.ts @@ -504,9 +504,9 @@ export class CoreFileUploaderHelperProvider { * @param defaultMessage Key of the default message to show. * @return Rejected promise. If it doesn't have an error message it means it was cancelled. */ - protected treatImageError(error: string | CoreError | CoreCaptureError, defaultMessage: string): CoreError { + protected treatImageError(error: number | string | CoreError | CoreCaptureError, defaultMessage: string): CoreError { // Cancelled or error. - if (!error) { + if (!error || typeof error == 'number') { return new CoreError(defaultMessage); } @@ -675,7 +675,7 @@ export class CoreFileUploaderHelperProvider { } catch (error) { const defaultError = fromAlbum ? 'core.fileuploader.errorgettingimagealbum' : 'core.fileuploader.errorcapturingimage'; - throw this.treatImageError(error, defaultError); + throw this.treatImageError(error, Translate.instant(defaultError)); } const error = CoreFileUploader.isInvalidMimetype(mimetypes, path); // Verify that the mimetype is supported.