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);
} 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);
}
/**

View File

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