diff --git a/src/core/fileuploader/providers/helper.ts b/src/core/fileuploader/providers/helper.ts index 903a5fda6..f6f9bd334 100644 --- a/src/core/fileuploader/providers/helper.ts +++ b/src/core/fileuploader/providers/helper.ts @@ -411,7 +411,7 @@ export class CoreFileUploaderHelperProvider { return Promise.reject(message); } else { - this.logger.debug('Cancelled'); + return Promise.reject(this.domUtils.createCanceledError()); } } } @@ -430,20 +430,18 @@ export class CoreFileUploaderHelperProvider { // Cancelled or error. if (error) { if (typeof error == 'string') { - if (error.toLowerCase().indexOf('error') > -1 || error.toLowerCase().indexOf('unable') > -1) { - this.logger.error('Error getting image: ' + error); - - return Promise.reject(error); - } else { + if (error.toLowerCase().indexOf('no image selected') > -1) { // User cancelled. - this.logger.debug('Cancelled'); + return Promise.reject(this.domUtils.createCanceledError()); } } else { return Promise.reject(this.translate.instant(defaultMessage)); } } - return Promise.reject(null); + this.logger.error('Error getting image: ', error); + + return Promise.reject(error); } /** diff --git a/src/core/sharedfiles/providers/helper.ts b/src/core/sharedfiles/providers/helper.ts index f5475061f..d88f16c44 100644 --- a/src/core/sharedfiles/providers/helper.ts +++ b/src/core/sharedfiles/providers/helper.ts @@ -109,7 +109,7 @@ export class CoreSharedFilesHelperProvider { modal.onDidDismiss((file: any) => { if (!file) { // User cancelled. - reject(); + reject(this.domUtils.createCanceledError()); return; }