MOBILE-3401 upload: Fix error displayed when cancelling

main
Dani Palou 2020-05-18 09:33:26 +02:00
parent 8f9e1ca01d
commit a475f3e188
2 changed files with 7 additions and 9 deletions

View File

@ -411,7 +411,7 @@ export class CoreFileUploaderHelperProvider {
return Promise.reject(message); return Promise.reject(message);
} else { } else {
this.logger.debug('Cancelled'); return Promise.reject(this.domUtils.createCanceledError());
} }
} }
} }
@ -430,20 +430,18 @@ export class CoreFileUploaderHelperProvider {
// Cancelled or error. // Cancelled or error.
if (error) { if (error) {
if (typeof error == 'string') { if (typeof error == 'string') {
if (error.toLowerCase().indexOf('error') > -1 || error.toLowerCase().indexOf('unable') > -1) { if (error.toLowerCase().indexOf('no image selected') > -1) {
this.logger.error('Error getting image: ' + error);
return Promise.reject(error);
} else {
// User cancelled. // User cancelled.
this.logger.debug('Cancelled'); return Promise.reject(this.domUtils.createCanceledError());
} }
} else { } else {
return Promise.reject(this.translate.instant(defaultMessage)); return Promise.reject(this.translate.instant(defaultMessage));
} }
} }
return Promise.reject(null); this.logger.error('Error getting image: ', error);
return Promise.reject(error);
} }
/** /**

View File

@ -109,7 +109,7 @@ export class CoreSharedFilesHelperProvider {
modal.onDidDismiss((file: any) => { modal.onDidDismiss((file: any) => {
if (!file) { if (!file) {
// User cancelled. // User cancelled.
reject(); reject(this.domUtils.createCanceledError());
return; return;
} }