Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>pull/45161/head
@@ -5,8 +5,8 @@ | |||
import { action } from './deleteAction' | |||
import { expect } from '@jest/globals' | |||
import { File, Folder, Permission, View, FileAction } from '@nextcloud/files' | |||
import eventBus from '@nextcloud/event-bus' | |||
import axios from '@nextcloud/axios' | |||
import eventBus from '@nextcloud/event-bus' | |||
import logger from '../logger' | |||
@@ -5,9 +5,9 @@ | |||
import { action } from './favoriteAction' | |||
import { expect } from '@jest/globals' | |||
import { File, Permission, View, FileAction } from '@nextcloud/files' | |||
import axios from '@nextcloud/axios' | |||
import eventBus from '@nextcloud/event-bus' | |||
import * as favoriteAction from './favoriteAction' | |||
import axios from '@nextcloud/axios' | |||
import logger from '../logger' | |||
const view = { |
@@ -7,14 +7,13 @@ import type { IFilePickerButton } from '@nextcloud/dialogs' | |||
import type { FileStat, ResponseDataDetailed } from 'webdav' | |||
import type { MoveCopyResult } from './moveOrCopyActionUtils' | |||
// eslint-disable-next-line n/no-extraneous-import | |||
import { AxiosError } from 'axios' | |||
import { basename, join } from 'path' | |||
import { emit } from '@nextcloud/event-bus' | |||
import { isAxiosError } from '@nextcloud/axios' | |||
import { FilePickerClosed, getFilePickerBuilder, showError } from '@nextcloud/dialogs' | |||
import { emit } from '@nextcloud/event-bus' | |||
import { Permission, FileAction, FileType, NodeStatus, davGetClient, davRootPath, davResultToNode, davGetDefaultPropfind } from '@nextcloud/files' | |||
import { translate as t } from '@nextcloud/l10n' | |||
import { openConflictPicker, hasConflict } from '@nextcloud/upload' | |||
import { basename, join } from 'path' | |||
import Vue from 'vue' | |||
import CopyIconSvg from '@mdi/svg/svg/folder-multiple.svg?raw' | |||
@@ -151,12 +150,12 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth | |||
emit('files:node:deleted', node) | |||
} | |||
} catch (error) { | |||
if (error instanceof AxiosError) { | |||
if (error?.response?.status === 412) { | |||
if (isAxiosError(error)) { | |||
if (error.response?.status === 412) { | |||
throw new Error(t('files', 'A file or folder with that name already exists in this folder')) | |||
} else if (error?.response?.status === 423) { | |||
} else if (error.response?.status === 423) { | |||
throw new Error(t('files', 'The files are locked')) | |||
} else if (error?.response?.status === 404) { | |||
} else if (error.response?.status === 404) { | |||
throw new Error(t('files', 'The file does not exist anymore')) | |||
} else if (error.message) { | |||
throw new Error(error.message) |
@@ -45,8 +45,7 @@ import { emit } from '@nextcloud/event-bus' | |||
import { FileType, NodeStatus, Permission } from '@nextcloud/files' | |||
import { loadState } from '@nextcloud/initial-state' | |||
import { translate as t } from '@nextcloud/l10n' | |||
import axios from '@nextcloud/axios' | |||
import { isAxiosError } from 'axios' | |||
import axios, { isAxiosError } from '@nextcloud/axios' | |||
import Vue, { defineComponent } from 'vue' | |||
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js' |
@@ -3,7 +3,7 @@ | |||
* SPDX-License-Identifier: AGPL-3.0-or-later | |||
*/ | |||
// eslint-disable-next-line n/no-extraneous-import | |||
import type { AxiosResponse } from 'axios' | |||
import type { AxiosResponse } from '@nextcloud/axios' | |||
import type { Node } from '@nextcloud/files' | |||
import type { StorageConfig } from '../services/externalStorage' | |||
@@ -3,7 +3,7 @@ | |||
* SPDX-License-Identifier: AGPL-3.0-or-later | |||
*/ | |||
// eslint-disable-next-line n/no-extraneous-import | |||
import type { AxiosError } from 'axios' | |||
import type { AxiosError } from '@nextcloud/axios' | |||
import type { Node } from '@nextcloud/files' | |||
import { showWarning } from '@nextcloud/dialogs' |
@@ -3,7 +3,7 @@ | |||
* SPDX-License-Identifier: AGPL-3.0-or-later | |||
*/ | |||
// eslint-disable-next-line n/no-extraneous-import | |||
import type { AxiosResponse } from 'axios' | |||
import type { AxiosResponse } from '@nextcloud/axios' | |||
import type { ContentsWithRoot } from '@nextcloud/files' | |||
import type { OCSResponse } from '@nextcloud/typings/ocs' | |||
@@ -3,7 +3,7 @@ | |||
* SPDX-License-Identifier: AGPL-3.0-or-later | |||
*/ | |||
/* eslint-disable camelcase, n/no-extraneous-import */ | |||
import type { AxiosPromise } from 'axios' | |||
import type { AxiosPromise } from '@nextcloud/axios' | |||
import type { OCSResponse } from '@nextcloud/typings/ocs' | |||
import { Folder, File, type ContentsWithRoot, Permission } from '@nextcloud/files' |
@@ -74,7 +74,7 @@ import debounce from 'debounce' | |||
import { mdiArrowLeft, mdiLock, mdiStar, mdiStarOutline, mdiTrashCan } from '@mdi/js' | |||
import FederationControl from '../shared/FederationControl.vue' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
import { ACCOUNT_PROPERTY_READABLE_ENUM, VERIFICATION_ENUM } from '../../../constants/AccountPropertyConstants.js' | |||
import { |
@@ -53,7 +53,7 @@ import HeaderBar from '../shared/HeaderBar.vue' | |||
import { ACCOUNT_PROPERTY_READABLE_ENUM, DEFAULT_ADDITIONAL_EMAIL_SCOPE, NAME_READABLE_ENUM } from '../../../constants/AccountPropertyConstants.js' | |||
import { savePrimaryEmail, removeAdditionalEmail } from '../../../service/PersonalInfo/EmailService.js' | |||
import { validateEmail } from '../../../utils/validate.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
const { emailMap: { additionalEmails, primaryEmail, notificationEmail } } = loadState('settings', 'personalInfoParameters', {}) | |||
const { displayNameChangeSupported } = loadState('settings', 'accountParameters', {}) |
@@ -27,7 +27,7 @@ | |||
import { ACCOUNT_SETTING_PROPERTY_ENUM } from '../../../constants/AccountPropertyConstants.js' | |||
import { savePrimaryAccountProperty } from '../../../service/PersonalInfo/PersonalInfoService.js' | |||
import { validateLanguage } from '../../../utils/validate.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' | |||
@@ -37,7 +37,7 @@ import MapClock from 'vue-material-design-icons/MapClock.vue' | |||
import { ACCOUNT_SETTING_PROPERTY_ENUM } from '../../../constants/AccountPropertyConstants.js' | |||
import { savePrimaryAccountProperty } from '../../../service/PersonalInfo/PersonalInfoService.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
export default { | |||
name: 'Locale', |
@@ -20,7 +20,7 @@ import { emit } from '@nextcloud/event-bus' | |||
import { savePrimaryAccountProperty } from '../../../service/PersonalInfo/PersonalInfoService.js' | |||
import { ACCOUNT_PROPERTY_ENUM } from '../../../constants/AccountPropertyConstants.js' | |||
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
export default { | |||
name: 'ProfileCheckbox', |
@@ -27,7 +27,7 @@ import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' | |||
import { saveProfileParameterVisibility } from '../../../service/ProfileService.js' | |||
import { VISIBILITY_PROPERTY_ENUM } from '../../../constants/ProfileConstants.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
const { profileEnabled } = loadState('settings', 'personalInfoParameters', false) | |||
@@ -52,7 +52,7 @@ import NcTextArea from '@nextcloud/vue/dist/Components/NcTextArea.js' | |||
import HeaderBar from './HeaderBar.vue' | |||
import { savePrimaryAccountProperty } from '../../../service/PersonalInfo/PersonalInfoService.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
export default { | |||
name: 'AccountPropertySection', |
@@ -46,7 +46,7 @@ import { | |||
UNPUBLISHED_READABLE_PROPERTIES, | |||
} from '../../../constants/AccountPropertyConstants.js' | |||
import { savePrimaryAccountPropertyScope } from '../../../service/PersonalInfo/PersonalInfoService.js' | |||
import { handleError } from '../../../utils/handlers.js' | |||
import { handleError } from '../../../utils/handlers.ts' | |||
const { | |||
federationEnabled, |
@@ -9,8 +9,7 @@ import { translate as t } from '@nextcloud/l10n' | |||
import { generateUrl } from '@nextcloud/router' | |||
import { startRegistration as registerWebAuthn } from '@simplewebauthn/browser' | |||
import Axios from 'axios' | |||
import axios from '@nextcloud/axios' | |||
import axios, { isAxiosError } from '@nextcloud/axios' | |||
import logger from '../logger' | |||
/** | |||
@@ -28,7 +27,7 @@ export async function startRegistration() { | |||
return attrs | |||
} catch (e) { | |||
logger.error(e as Error) | |||
if (Axios.isAxiosError(e)) { | |||
if (isAxiosError(e)) { | |||
throw new Error(t('settings', 'Could not register device: Network error')) | |||
} else if ((e as Error).name === 'InvalidStateError') { | |||
throw new Error(t('settings', 'Could not register device: Probably already registered')) |
@@ -3,16 +3,17 @@ | |||
* SPDX-License-Identifier: AGPL-3.0-or-later | |||
*/ | |||
import type { AxiosError } from '@nextcloud/axios' | |||
import { showError } from '@nextcloud/dialogs' | |||
import { translate as t } from '@nextcloud/l10n' | |||
import logger from '../logger.ts' | |||
/** | |||
* @param {import('axios').AxiosError} error the error | |||
* @param {string?} message the message to display | |||
* @param error the error | |||
* @param message the message to display | |||
*/ | |||
export const handleError = (error, message) => { | |||
export function handleError(error: AxiosError, message: string) { | |||
let fullMessage = '' | |||
if (message) { | |||
@@ -26,6 +27,7 @@ export const handleError = (error, message) => { | |||
fullMessage += t('settings', 'There were too many requests from your network. Retry later or contact your administrator if this is an error.') | |||
} | |||
fullMessage = fullMessage || t('settings', 'Error') | |||
showError(fullMessage) | |||
logger.error(fullMessage || t('Error'), error) | |||
logger.error(fullMessage, { error }) | |||
} |
@@ -12,11 +12,11 @@ | |||
"@chenfengyuan/vue-qrcode": "^1.0.2", | |||
"@mdi/js": "^7.4.47", | |||
"@mdi/svg": "^7.4.47", | |||
"@nextcloud/auth": "^2.1.0", | |||
"@nextcloud/axios": "^2.3.0", | |||
"@nextcloud/browser-storage": "^0.3.0", | |||
"@nextcloud/auth": "^2.3.0", | |||
"@nextcloud/axios": "^2.5.0", | |||
"@nextcloud/browser-storage": "^0.4.0", | |||
"@nextcloud/browserslist-config": "^3.0.1", | |||
"@nextcloud/calendar-availability-vue": "^2.2.0", | |||
"@nextcloud/calendar-availability-vue": "^2.2.1", | |||
"@nextcloud/capabilities": "^1.0.4", | |||
"@nextcloud/dialogs": "^5.3.1", | |||
"@nextcloud/event-bus": "^3.3.1", | |||
@@ -4197,30 +4197,17 @@ | |||
} | |||
}, | |||
"node_modules/@nextcloud/axios": { | |||
"version": "2.4.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/axios/-/axios-2.4.0.tgz", | |||
"integrity": "sha512-ARGzT9p45L0sjRIV3JZWGPtMbwgxd4eEMcMJNn58NA7UQIsMkTwHb5pXQjL+5elXY9zp/JMz7n/7SHTp0bkuXQ==", | |||
"dependencies": { | |||
"@nextcloud/auth": "^2.1.0", | |||
"@nextcloud/router": "^2.1.2", | |||
"axios": "^1.4.0" | |||
}, | |||
"engines": { | |||
"node": "^20.0.0", | |||
"npm": "^9.0.0" | |||
} | |||
}, | |||
"node_modules/@nextcloud/axios/node_modules/@nextcloud/router": { | |||
"version": "2.2.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.2.0.tgz", | |||
"integrity": "sha512-M4AVGnB5tt3MYO5RpH/R2jq7z/nW05AmRhk4Lh68krVwRIYGo8pgNikKrPGogHd2Q3UgzF5Py1drHz3uuV99bQ==", | |||
"version": "2.5.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/axios/-/axios-2.5.0.tgz", | |||
"integrity": "sha512-82LQ5PZA0ZVUnS8QiGoAGOR5kE7EKD84qEEgeZJ+Y7p5iljwi3AT6niQuP7YuHjt3MKM+6jQiyghZk5SquiszQ==", | |||
"dependencies": { | |||
"@nextcloud/typings": "^1.7.0", | |||
"core-js": "^3.6.4" | |||
"@nextcloud/auth": "^2.3.0", | |||
"@nextcloud/router": "^3.0.1", | |||
"axios": "^1.6.8" | |||
}, | |||
"engines": { | |||
"node": "^20.0.0", | |||
"npm": "^9.0.0" | |||
"npm": "^10.0.0" | |||
} | |||
}, | |||
"node_modules/@nextcloud/babel-config": { | |||
@@ -4238,21 +4225,21 @@ | |||
} | |||
}, | |||
"node_modules/@nextcloud/browser-storage": { | |||
"version": "0.3.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/browser-storage/-/browser-storage-0.3.0.tgz", | |||
"integrity": "sha512-vqc26T4WQ3y9EbFpHh4dl/FN7ahEfEoc0unQmsdJ2YSZNTxTvAXAasWI6HFNcHi10b5rEYxxEYjAwKF34th3Aw==", | |||
"version": "0.4.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/browser-storage/-/browser-storage-0.4.0.tgz", | |||
"integrity": "sha512-D6XxznxCYmJ3oBCC3p0JB6GZJ2RZ9dgbB1UqtTePXrIvHUMBAeF/YkiGKYxLAVZCZb+NSNZXgAYHm/3LnIUbDg==", | |||
"dependencies": { | |||
"core-js": "3.33.0" | |||
"core-js": "3.37.0" | |||
}, | |||
"engines": { | |||
"node": "^20.0.0", | |||
"npm": "^9.0.0" | |||
"npm": "^10.0.0" | |||
} | |||
}, | |||
"node_modules/@nextcloud/browser-storage/node_modules/core-js": { | |||
"version": "3.33.0", | |||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.0.tgz", | |||
"integrity": "sha512-HoZr92+ZjFEKar5HS6MC776gYslNOKHt75mEBKWKnPeFDpZ6nH5OeF3S6HFT1mUAUZKrzkez05VboaX8myjSuw==", | |||
"version": "3.37.0", | |||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.0.tgz", | |||
"integrity": "sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==", | |||
"hasInstallScript": true, | |||
"funding": { | |||
"type": "opencollective", | |||
@@ -4269,12 +4256,12 @@ | |||
} | |||
}, | |||
"node_modules/@nextcloud/calendar-availability-vue": { | |||
"version": "2.2.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/calendar-availability-vue/-/calendar-availability-vue-2.2.0.tgz", | |||
"integrity": "sha512-0qFTfH0WNaaGuWNjA8ITXGkEG6JeQ907cfOrw4BwadezabzqflJgPvewefW45Xa6R13yop55CDwht1t82+/tyQ==", | |||
"version": "2.2.1", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/calendar-availability-vue/-/calendar-availability-vue-2.2.1.tgz", | |||
"integrity": "sha512-jOCMZz3q/C5fat2c646V77TolibWBFM58wXDMbzTx6G5GEnXFiAUxWCN2at4IXVtb1N1KZQtIqEHXCZ4cXuihw==", | |||
"dependencies": { | |||
"@nextcloud/logger": "^2.4.0", | |||
"ical.js": "^1.4.0", | |||
"@nextcloud/logger": "^3.0.1", | |||
"ical.js": "^2.0.1", | |||
"icalzone": "^0.0.1", | |||
"uuid": "^9.0.0", | |||
"vue-material-design-icons": "^5.1.2" | |||
@@ -4289,18 +4276,10 @@ | |||
"vue": "^2.7" | |||
} | |||
}, | |||
"node_modules/@nextcloud/calendar-availability-vue/node_modules/@nextcloud/logger": { | |||
"version": "2.7.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/logger/-/logger-2.7.0.tgz", | |||
"integrity": "sha512-DSJg9H1jT2zfr7uoP4tL5hKncyY+LOuxJzLauj0M/f6gnpoXU5WG1Zw8EFPOrRWjkC0ZE+NCqrMnITgdRRpXJQ==", | |||
"dependencies": { | |||
"@nextcloud/auth": "^2.0.0", | |||
"core-js": "^3.6.4" | |||
}, | |||
"engines": { | |||
"node": "^20.0.0", | |||
"npm": "^9.0.0" | |||
} | |||
"node_modules/@nextcloud/calendar-availability-vue/node_modules/ical.js": { | |||
"version": "2.0.1", | |||
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-2.0.1.tgz", | |||
"integrity": "sha512-uYYb1CwTXbd9NP/xTtgQZ5ivv6bpUjQu9VM98s3X78L3XRu00uJW5ZtmnLwyxhztpf5fSiRyDpFW7ZNCePlaPw==" | |||
}, | |||
"node_modules/@nextcloud/calendar-js": { | |||
"version": "6.1.0", | |||
@@ -4755,6 +4734,18 @@ | |||
"vue": "2.x" | |||
} | |||
}, | |||
"node_modules/@nextcloud/vue/node_modules/@nextcloud/browser-storage": { | |||
"version": "0.3.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/browser-storage/-/browser-storage-0.3.0.tgz", | |||
"integrity": "sha512-vqc26T4WQ3y9EbFpHh4dl/FN7ahEfEoc0unQmsdJ2YSZNTxTvAXAasWI6HFNcHi10b5rEYxxEYjAwKF34th3Aw==", | |||
"dependencies": { | |||
"core-js": "3.33.0" | |||
}, | |||
"engines": { | |||
"node": "^20.0.0", | |||
"npm": "^9.0.0" | |||
} | |||
}, | |||
"node_modules/@nextcloud/vue/node_modules/@nextcloud/logger": { | |||
"version": "2.7.0", | |||
"resolved": "https://registry.npmjs.org/@nextcloud/logger/-/logger-2.7.0.tgz", | |||
@@ -4768,6 +4759,16 @@ | |||
"npm": "^9.0.0" | |||
} | |||
}, | |||
"node_modules/@nextcloud/vue/node_modules/core-js": { | |||
"version": "3.33.0", | |||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.0.tgz", | |||
"integrity": "sha512-HoZr92+ZjFEKar5HS6MC776gYslNOKHt75mEBKWKnPeFDpZ6nH5OeF3S6HFT1mUAUZKrzkez05VboaX8myjSuw==", | |||
"hasInstallScript": true, | |||
"funding": { | |||
"type": "opencollective", | |||
"url": "https://opencollective.com/core-js" | |||
} | |||
}, | |||
"node_modules/@nextcloud/vue/node_modules/debounce": { | |||
"version": "2.0.0", | |||
"resolved": "https://registry.npmjs.org/debounce/-/debounce-2.0.0.tgz", | |||
@@ -14941,7 +14942,8 @@ | |||
"node_modules/ical.js": { | |||
"version": "1.5.0", | |||
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-1.5.0.tgz", | |||
"integrity": "sha512-7ZxMkogUkkaCx810yp0ZGKvq1ZpRgJeornPttpoxe6nYZ3NLesZe1wWMXDdwTkj/b5NtXT+Y16Aakph/ao98ZQ==" | |||
"integrity": "sha512-7ZxMkogUkkaCx810yp0ZGKvq1ZpRgJeornPttpoxe6nYZ3NLesZe1wWMXDdwTkj/b5NtXT+Y16Aakph/ao98ZQ==", | |||
"peer": true | |||
}, | |||
"node_modules/icalzone": { | |||
"version": "0.0.1", |
@@ -40,11 +40,11 @@ | |||
"@chenfengyuan/vue-qrcode": "^1.0.2", | |||
"@mdi/js": "^7.4.47", | |||
"@mdi/svg": "^7.4.47", | |||
"@nextcloud/auth": "^2.1.0", | |||
"@nextcloud/axios": "^2.3.0", | |||
"@nextcloud/browser-storage": "^0.3.0", | |||
"@nextcloud/auth": "^2.3.0", | |||
"@nextcloud/axios": "^2.5.0", | |||
"@nextcloud/browser-storage": "^0.4.0", | |||
"@nextcloud/browserslist-config": "^3.0.1", | |||
"@nextcloud/calendar-availability-vue": "^2.2.0", | |||
"@nextcloud/calendar-availability-vue": "^2.2.1", | |||
"@nextcloud/capabilities": "^1.0.4", | |||
"@nextcloud/dialogs": "^5.3.1", | |||
"@nextcloud/event-bus": "^3.3.1", |