MOBILE-3496 core: Fix treating number errors in camera

main
Dani Palou 2021-04-13 12:21:57 +02:00
parent 9d0be0e7f8
commit 31ac342b80
1 changed files with 3 additions and 3 deletions

View File

@ -504,9 +504,9 @@ export class CoreFileUploaderHelperProvider {
* @param defaultMessage Key of the default message to show. * @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. * @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. // Cancelled or error.
if (!error) { if (!error || typeof error == 'number') {
return new CoreError(defaultMessage); return new CoreError(defaultMessage);
} }
@ -675,7 +675,7 @@ export class CoreFileUploaderHelperProvider {
} catch (error) { } catch (error) {
const defaultError = fromAlbum ? 'core.fileuploader.errorgettingimagealbum' : 'core.fileuploader.errorcapturingimage'; 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. const error = CoreFileUploader.isInvalidMimetype(mimetypes, path); // Verify that the mimetype is supported.