diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-01-18 15:34:17 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-01-18 15:37:02 +0100 |
commit | f69a6c675cdc1d699925d73065cce407acfaf421 (patch) | |
tree | a88c7a7443e2b43bea484491fc08c48e672a09fa /apps/files_sharing/src | |
parent | e9b5805e6c80ff2ccba7f6eb5f9213dce7e756e0 (diff) | |
download | nextcloud-server-f69a6c675cdc1d699925d73065cce407acfaf421.tar.gz nextcloud-server-f69a6c675cdc1d699925d73065cce407acfaf421.zip |
Show the actual error on share requests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r-- | apps/files_sharing/src/mixins/ShareRequests.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/apps/files_sharing/src/mixins/ShareRequests.js b/apps/files_sharing/src/mixins/ShareRequests.js index 8c54eb15dce..e6867514c2a 100644 --- a/apps/files_sharing/src/mixins/ShareRequests.js +++ b/apps/files_sharing/src/mixins/ShareRequests.js @@ -59,7 +59,11 @@ export default { return new Share(request.data.ocs.data) } catch (error) { console.error('Error while creating share', error) - OC.Notification.showTemporary(t('files_sharing', 'Error creating the share'), { type: 'error' }) + const errorMessage = error?.response?.data?.ocs?.meta?.message + OC.Notification.showTemporary( + errorMessage ? t('files_sharing', 'Error creating the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error creating the share'), + { type: 'error' } + ) throw error } }, @@ -79,7 +83,11 @@ export default { return true } catch (error) { console.error('Error while deleting share', error) - OC.Notification.showTemporary(t('files_sharing', 'Error deleting the share'), { type: 'error' }) + const errorMessage = error?.response?.data?.ocs?.meta?.message + OC.Notification.showTemporary( + errorMessage ? t('files_sharing', 'Error deleting the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error deleting the share'), + { type: 'error' } + ) throw error } }, @@ -100,7 +108,11 @@ export default { } catch (error) { console.error('Error while updating share', error) if (error.response.status !== 400) { - OC.Notification.showTemporary(t('files_sharing', 'Error updating the share'), { type: 'error' }) + const errorMessage = error?.response?.data?.ocs?.meta?.message + OC.Notification.showTemporary( + errorMessage ? t('files_sharing', 'Error updating the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error updating the share'), + { type: 'error' } + ) } const message = error.response.data.ocs.meta.message throw new Error(message) |