@knime/hub-features 1.15.3 → 1.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/components/versions/composables/useVersionsApi.ts +2 -6
- package/src/rfcErrors/RFCErrorToastTemplate.vue +8 -3
- package/src/rfcErrors/index.ts +13 -6
- package/src/useDownloadArtifact/useDownloadArtifact.ts +1 -4
- package/src/useFileUpload/useFileUpload.ts +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @knime/hub-features
|
|
2
2
|
|
|
3
|
+
## 1.15.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 301cfc2: Fix inconsistent error toast text when stack trace is provided but copying to clipboard is not allowed
|
|
8
|
+
|
|
9
|
+
## 1.15.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e44c108: fix rfcErrors parser and return undefined on error
|
|
14
|
+
- Updated dependencies [e44c108]
|
|
15
|
+
- @knime/components@1.41.8
|
|
16
|
+
|
|
3
17
|
## 1.15.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/hub-features",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.5",
|
|
4
4
|
"description": "Vue components & composables for shared hub features",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"lodash-es": "4.17.21",
|
|
37
37
|
"ofetch": "^1.4.1",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
|
-
"@knime/components": "1.41.7",
|
|
40
39
|
"@knime/styles": "1.14.3",
|
|
41
|
-
"@knime/utils": "1.7.1"
|
|
40
|
+
"@knime/utils": "1.7.1",
|
|
41
|
+
"@knime/components": "1.41.8"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"consola": "3.x",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type FetchOptions } from "ofetch";
|
|
2
2
|
|
|
3
3
|
import { type HubAvatarData, rfcErrors } from "@knime/hub-features";
|
|
4
4
|
import { VERSION_DEFAULT_LIMIT } from "@knime/hub-features/versions";
|
|
@@ -37,11 +37,7 @@ export const useVersionsApi = ({
|
|
|
37
37
|
|
|
38
38
|
return await $ofetch(path, { ...defaults, ...fetchOptions });
|
|
39
39
|
} catch (error) {
|
|
40
|
-
|
|
41
|
-
throw rfcErrors.tryParse(error);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
throw error;
|
|
40
|
+
throw rfcErrors.tryParse(error) ?? error;
|
|
45
41
|
}
|
|
46
42
|
};
|
|
47
43
|
|
|
@@ -102,7 +102,12 @@ const onShowDetailsClicked = () => {
|
|
|
102
102
|
<div class="title">
|
|
103
103
|
{{ props.title }}
|
|
104
104
|
</div>
|
|
105
|
-
<button
|
|
105
|
+
<button
|
|
106
|
+
v-if="!showDetails"
|
|
107
|
+
data-test-id="show-details"
|
|
108
|
+
class="show-more"
|
|
109
|
+
@click="onShowDetailsClicked"
|
|
110
|
+
>
|
|
106
111
|
Show details
|
|
107
112
|
</button>
|
|
108
113
|
<div v-if="showDetails" class="additional-info">
|
|
@@ -124,11 +129,11 @@ const onShowDetailsClicked = () => {
|
|
|
124
129
|
<div v-if="date"><strong>Date: </strong>{{ formattedDate }}</div>
|
|
125
130
|
<div v-if="requestId"><strong>Request id: </strong>{{ requestId }}</div>
|
|
126
131
|
<div v-if="errorId"><strong>Error id: </strong>{{ errorId }}</div>
|
|
127
|
-
<div v-if="stacktrace">
|
|
132
|
+
<div v-if="stacktrace && canCopyToClipboard">
|
|
128
133
|
<strong>Stacktrace: </strong>Part of clipboard text
|
|
129
134
|
</div>
|
|
130
135
|
<div v-if="canCopyToClipboard" class="copy-button-wrapper">
|
|
131
|
-
<Button @click="copyToClipboard">
|
|
136
|
+
<Button data-test-id="copy-to-clipboard" @click="copyToClipboard">
|
|
132
137
|
<template v-if="copied">
|
|
133
138
|
<CheckIcon class="copy-icon" />Error was copied
|
|
134
139
|
</template>
|
package/src/rfcErrors/index.ts
CHANGED
|
@@ -35,21 +35,28 @@ const toToast = ({
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Parse an ofetch's `FetchError` to an `RFCError`.
|
|
39
|
+
* When parsing is not possible it returns undefined.
|
|
40
40
|
*/
|
|
41
|
-
const tryParse = (error:
|
|
41
|
+
const tryParse = (error: unknown): RFCError | undefined => {
|
|
42
|
+
if (!(error instanceof FetchError)) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
if (!error.response) {
|
|
43
|
-
return
|
|
47
|
+
return undefined;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
const responseDate = error.response.headers.get("date")
|
|
47
51
|
? new Date(error.response.headers.get("date")!)
|
|
48
52
|
: undefined;
|
|
49
53
|
|
|
54
|
+
const title =
|
|
55
|
+
typeof error.data === "string" ? error.data : error.data?.title ?? "";
|
|
56
|
+
|
|
50
57
|
const rfcErrorData: RFCErrorData = {
|
|
51
|
-
title:
|
|
52
|
-
details: error.data
|
|
58
|
+
title: title as string,
|
|
59
|
+
details: error.data?.details as string[] | undefined,
|
|
53
60
|
status: error.statusCode as number,
|
|
54
61
|
date: responseDate,
|
|
55
62
|
requestId: error.response.headers.get("x-request-id") ?? undefined,
|
|
@@ -284,10 +284,7 @@ export const useDownloadArtifact = (
|
|
|
284
284
|
} catch (error: unknown) {
|
|
285
285
|
// here only errors thrown by the initial requests are caught;
|
|
286
286
|
// errors occurring while polling will be handled in pollDownloadItem
|
|
287
|
-
|
|
288
|
-
throw rfcErrors.tryParse(error);
|
|
289
|
-
}
|
|
290
|
-
throw error;
|
|
287
|
+
throw rfcErrors.tryParse(error) ?? error;
|
|
291
288
|
}
|
|
292
289
|
};
|
|
293
290
|
|
|
@@ -287,11 +287,7 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
|
|
|
287
287
|
|
|
288
288
|
useUploadManagerResult.start(parentId, uploadPayload);
|
|
289
289
|
} catch (error) {
|
|
290
|
-
|
|
291
|
-
throw rfcErrors.tryParse(error);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
throw error;
|
|
290
|
+
throw rfcErrors.tryParse(error) ?? error;
|
|
295
291
|
} finally {
|
|
296
292
|
// errors can only be thrown in the prepareUpload call, useUploadManagerResult.start does its own error handling
|
|
297
293
|
prepareQueueSize.value -= enqueableFiles.length;
|