Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cryptic errors #754

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@graasp/chatbox": "2.0.0",
"@graasp/query-client": "1.4.1",
"@graasp/sdk": "1.2.0",
"@graasp/translations": "1.18.1",
"@graasp/ui": "3.3.1",
"@graasp/query-client": "1.4.3",
"@graasp/sdk": "1.2.1",
"@graasp/translations": "1.18.3",
"@graasp/ui": "3.3.2",
"@mui/icons-material": "5.14.3",
"@mui/lab": "5.0.0-alpha.138",
"@mui/material": "5.14.5",
Expand All @@ -37,10 +37,11 @@
"@uppy/xhr-upload": "3.3.1",
"ag-grid-community": "29.3.5",
"ag-grid-react": "29.3.5",
"axios": "1.4.0",
"date-fns": "2.30.0",
"filesize": "10.0.12",
"http-status-codes": "2.2.0",
"immutable": "4.3.1",
"immutable": "4.3.2",
"katex": "0.16.8",
"lodash.groupby": "4.6.0",
"lodash.partition": "4.6.0",
Expand Down
17 changes: 15 additions & 2 deletions src/config/notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import buildI18n, {
REQUEST_MESSAGES,
} from '@graasp/translations';

import { AxiosError } from 'axios';

import {
COPY_ITEM_LINK_TO_CLIPBOARD,
COPY_MEMBER_ID_TO_CLIPBOARD,
Expand All @@ -23,8 +25,19 @@ type Payload = ErrorPayload & SuccessPayload;

const i18n = buildI18n();

const getErrorMessageFromPayload = (payload?: ErrorPayload) =>
i18n.t(payload?.error?.message ?? FAILURE_MESSAGES.UNEXPECTED_ERROR);
const getErrorMessageFromPayload = (
payload?: Parameters<Notifier>[0]['payload'],
) => {
if (payload?.error && payload.error instanceof AxiosError) {
if (payload.error.isAxiosError) {
return (
payload.error.response?.data.message ??
FAILURE_MESSAGES.UNEXPECTED_ERROR
);
}
}
return payload?.error?.message ?? FAILURE_MESSAGES.UNEXPECTED_ERROR;
};

const getSuccessMessageFromPayload = (payload?: SuccessPayload) =>
i18n.t(payload?.message ?? 'The operation successfully proceeded');
Expand Down
124 changes: 49 additions & 75 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/runtime@npm:^7.20.6, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.22.6":
"@babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.22.6":
version: 7.22.6
resolution: "@babel/runtime@npm:7.22.6"
dependencies:
Expand Down Expand Up @@ -2062,80 +2062,60 @@ __metadata:
languageName: node
linkType: hard

"@graasp/query-client@npm:1.4.1":
version: 1.4.1
resolution: "@graasp/query-client@npm:1.4.1"
"@graasp/query-client@npm:1.4.3":
version: 1.4.3
resolution: "@graasp/query-client@npm:1.4.3"
dependencies:
"@graasp/sdk": 1.2.0
"@graasp/translations": 1.18.1
"@graasp/sdk": 1.2.1
"@graasp/translations": 1.18.3
axios: 0.27.2
crypto-js: 4.1.1
http-status-codes: 2.2.0
immutable: 4.3.1
immutable: 4.3.2
qs: 6.11.2
react-query: 3.39.3
uuid: 9.0.0
peerDependencies:
react: ^17.0.0
checksum: 95d97d12d4d8fee4c06fbce468edd58909e35b63a05e34de4a5cf44d9f5f2246bfae296e97cbef04e72e46160b53059a757aac2118c9074e647f4781efc34705
checksum: d6789d5a0ef00b5febbabdf92cbb5904ffbc1359ee9fcd80c6e9be30e7008b4ae114cbb5ae543e49d2a58a838201d6f834d27c8582859bcc21a47ff42c49abb3
languageName: node
linkType: hard

"@graasp/sdk@npm:1.1.3":
version: 1.1.3
resolution: "@graasp/sdk@npm:1.1.3"
dependencies:
"@aws-sdk/client-s3": 3.370.0
"@fastify/secure-session": 6.1.0
"@graasp/etherpad-api": 2.1.1
fastify: 4.18.0
fluent-json-schema: 4.1.0
immutable: 4.3.1
js-cookie: 3.0.5
qs: 6.11.2
typeorm: 0.3.17
uuid: 9.0.0
validator: 13.9.0
checksum: 76899bd698ff9eab3849f4a0577ff84c2e32ffdddf88d9c8a3674c1246f420e708671caa013017e15f059ffba2b04acd215bd6aaad1bb166e5db88ba03162eb7
languageName: node
linkType: hard

"@graasp/sdk@npm:1.2.0":
version: 1.2.0
resolution: "@graasp/sdk@npm:1.2.0"
"@graasp/sdk@npm:1.2.1":
version: 1.2.1
resolution: "@graasp/sdk@npm:1.2.1"
dependencies:
"@aws-sdk/client-s3": 3.370.0
"@fastify/secure-session": 6.1.0
"@graasp/etherpad-api": 2.1.1
fastify: 4.18.0
fluent-json-schema: 4.1.0
immutable: 4.3.1
immutable: 4.3.2
js-cookie: 3.0.5
qs: 6.11.2
typeorm: 0.3.17
uuid: 9.0.0
validator: 13.9.0
checksum: 478eeff4f2c505876b6e555c64ab41176c636d971c2012ffbf7196d242ed04807286b34f281f5aa063e5cc82b14eb47a7fb6ba631073906ae78aea31807e53eb
validator: 13.11.0
checksum: 8507f3157e77a1cf0fb9e01a32c72cbfdb8bd3fd5a960a5fa299dbe36eba4a6f28f5f094a5d09214599e54a1fd91b95e945f80525a6165e4caf96ca9822544b7
languageName: node
linkType: hard

"@graasp/translations@npm:1.18.1":
version: 1.18.1
resolution: "@graasp/translations@npm:1.18.1"
"@graasp/translations@npm:1.18.3":
version: 1.18.3
resolution: "@graasp/translations@npm:1.18.3"
dependencies:
i18next: 22.4.15
checksum: 84ca62be4646649469df867dcf9ab9dc8f8ad11eb3b4720d434eb63d544e15f3cd89cb971170b73703324780b4277ed8fe6e89a948ae6e1672173726a0d24ad5
i18next: 23.4.4
checksum: d980d3042d956c22a4f58fb0c9e15e6559688c8eb9c0636dc3d4e3038b84204a886e9370a2a2a45e6f07da821a223b2a0f31d472747e47624d0e3465f02f457f
languageName: node
linkType: hard

"@graasp/ui@npm:3.3.1":
version: 3.3.1
resolution: "@graasp/ui@npm:3.3.1"
"@graasp/ui@npm:3.3.2":
version: 3.3.2
resolution: "@graasp/ui@npm:3.3.2"
dependencies:
"@graasp/sdk": 1.1.3
clsx: 2.0.0
"@graasp/sdk": 1.2.1
http-status-codes: 2.2.0
immutable: 4.3.1
immutable: 4.3.2
katex: 0.16.8
lodash.truncate: 4.4.2
qs: 6.11.2
Expand All @@ -2146,7 +2126,7 @@ __metadata:
react-text-mask: 5.5.0
uuid: 9.0.0
peerDependencies:
"@emotion/cache": ~11.10.7
"@emotion/cache": ~11.10.7 || ~11.11.0
"@emotion/react": ~11.10.6 || ~11.11.0
"@emotion/styled": ~11.10.6 || ~11.11.0
"@mui/icons-material": ~5.11.9 || ~5.13.0 || ~5.14.0
Expand All @@ -2166,7 +2146,7 @@ __metadata:
optional: true
ag-grid-react:
optional: true
checksum: 1fee38056662a914aee7aed22aeba1836a4c64f2b6422e0bafcd6f6773eae1eb6634019c07a4469b92bc4ef05737b2e696f3c4706c5f2b4d12b87099cad9a104
checksum: 2848bd2a467b2ce594eb95ee6f00c7acff1df01724a3849df42959d30e64b0233933d01ab28322deeeaf9cd0f8122039887f7914e00366496fb72549aa4fc774
languageName: node
linkType: hard

Expand Down Expand Up @@ -4675,7 +4655,7 @@ __metadata:
languageName: node
linkType: hard

"axios@npm:^1.3.5":
"axios@npm:1.4.0, axios@npm:^1.3.5":
version: 1.4.0
resolution: "axios@npm:1.4.0"
dependencies:
Expand Down Expand Up @@ -5184,20 +5164,20 @@ __metadata:
languageName: node
linkType: hard

"clsx@npm:2.0.0, clsx@npm:^2.0.0":
version: 2.0.0
resolution: "clsx@npm:2.0.0"
checksum: a2cfb2351b254611acf92faa0daf15220f4cd648bdf96ce369d729813b85336993871a4bf6978ddea2b81b5a130478339c20d9d0b5c6fc287e5147f0c059276e
languageName: node
linkType: hard

"clsx@npm:^1.1.1":
version: 1.2.1
resolution: "clsx@npm:1.2.1"
checksum: 30befca8019b2eb7dbad38cff6266cf543091dae2825c856a62a8ccf2c3ab9c2907c4d12b288b73101196767f66812365400a227581484a05f968b0307cfaf12
languageName: node
linkType: hard

"clsx@npm:^2.0.0":
version: 2.0.0
resolution: "clsx@npm:2.0.0"
checksum: a2cfb2351b254611acf92faa0daf15220f4cd648bdf96ce369d729813b85336993871a4bf6978ddea2b81b5a130478339c20d9d0b5c6fc287e5147f0c059276e
languageName: node
linkType: hard

"color-convert@npm:^1.9.0":
version: 1.9.3
resolution: "color-convert@npm:1.9.3"
Expand Down Expand Up @@ -7477,10 +7457,10 @@ __metadata:
"@emotion/react": 11.11.1
"@emotion/styled": 11.11.0
"@graasp/chatbox": 2.0.0
"@graasp/query-client": 1.4.1
"@graasp/sdk": 1.2.0
"@graasp/translations": 1.18.1
"@graasp/ui": 3.3.1
"@graasp/query-client": 1.4.3
"@graasp/sdk": 1.2.1
"@graasp/translations": 1.18.3
"@graasp/ui": 3.3.2
"@mui/icons-material": 5.14.3
"@mui/lab": 5.0.0-alpha.138
"@mui/material": 5.14.5
Expand Down Expand Up @@ -7515,6 +7495,7 @@ __metadata:
"@vitejs/plugin-react": 4.0.4
ag-grid-community: 29.3.5
ag-grid-react: 29.3.5
axios: 1.4.0
concurrently: 8.2.0
cypress: 12.17.4
cypress-localstorage-commands: 2.2.4
Expand All @@ -7531,7 +7512,7 @@ __metadata:
filesize: 10.0.12
http-status-codes: 2.2.0
husky: 8.0.3
immutable: 4.3.1
immutable: 4.3.2
katex: 0.16.8
lodash.groupby: 4.6.0
lodash.partition: 4.6.0
Expand Down Expand Up @@ -7829,12 +7810,12 @@ __metadata:
languageName: node
linkType: hard

"i18next@npm:22.4.15":
version: 22.4.15
resolution: "i18next@npm:22.4.15"
"i18next@npm:23.4.4":
version: 23.4.4
resolution: "i18next@npm:23.4.4"
dependencies:
"@babel/runtime": ^7.20.6
checksum: fced898227983e439c59e7aa6e7b87e53ad1b8a1c85f0613a968881418266e5336e9443831125590559796075d516fe3dbf8118679c894094a0a404be78b02a2
"@babel/runtime": ^7.22.5
checksum: faa968dcba328528231e3cd140d5a0f4b9b472b75874b7cbf8415e2dbff48397f1cdcc36a739ea6915f6970c367fdd7f985f120e63e1c30a839c53e366d851fd
languageName: node
linkType: hard

Expand All @@ -7861,10 +7842,10 @@ __metadata:
languageName: node
linkType: hard

"immutable@npm:4.3.1":
version: 4.3.1
resolution: "immutable@npm:4.3.1"
checksum: a3a5ba29bd43f3f9a2e4d599763d7455d11a0ea57e50bf43f2836672fc80003e90d69f2a4f5b589f1f3d6986faf97f08ce1e253583740dd33c00adebab88b217
"immutable@npm:4.3.2":
version: 4.3.2
resolution: "immutable@npm:4.3.2"
checksum: bb1d0f3eb8ebef04aa9e2c698ba1a248976a4dc0257fa2f1bffaaae575f891395fe9ef39eaf49856d6c4edd31704e300ec563ed44ea9d7c7996186deab91d0ff
languageName: node
linkType: hard

Expand Down Expand Up @@ -13074,13 +13055,6 @@ __metadata:
languageName: node
linkType: hard

"validator@npm:13.9.0":
version: 13.9.0
resolution: "validator@npm:13.9.0"
checksum: e2c936f041f61faa42bafd17c6faddf939498666cd82e88d733621c286893730b008959f4cb12ab3e236148a4f3805c30b85e3dcf5e0efd8b0cbcd36c02bfc0c
languageName: node
linkType: hard

"verror@npm:1.10.0":
version: 1.10.0
resolution: "verror@npm:1.10.0"
Expand Down