@floegence/redevplugin-ui 3.0.14 → 3.0.16
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/dist/errors.d.ts +2 -1
- package/dist/errors.js +3 -1
- package/dist/http.js +6 -4
- package/package.json +2 -2
package/dist/errors.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ export declare class PluginPlatformRequestError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class PluginTransportError extends Error {
|
|
15
15
|
readonly mutationOutcome?: PluginMutationOutcome;
|
|
16
|
+
readonly httpStatus?: number;
|
|
16
17
|
readonly cause: unknown;
|
|
17
|
-
constructor(message: string, cause: unknown, mutationOutcome?: PluginMutationOutcome);
|
|
18
|
+
constructor(message: string, cause: unknown, mutationOutcome?: PluginMutationOutcome, httpStatus?: number);
|
|
18
19
|
}
|
|
19
20
|
export declare class PluginBridgeError extends Error {
|
|
20
21
|
readonly errorCode: string;
|
package/dist/errors.js
CHANGED
|
@@ -13,12 +13,14 @@ export class PluginPlatformRequestError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
export class PluginTransportError extends Error {
|
|
15
15
|
mutationOutcome;
|
|
16
|
+
httpStatus;
|
|
16
17
|
cause;
|
|
17
|
-
constructor(message, cause, mutationOutcome) {
|
|
18
|
+
constructor(message, cause, mutationOutcome, httpStatus) {
|
|
18
19
|
super(message, { cause });
|
|
19
20
|
this.name = "PluginTransportError";
|
|
20
21
|
this.cause = cause;
|
|
21
22
|
this.mutationOutcome = mutationOutcome;
|
|
23
|
+
this.httpStatus = httpStatus;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
export class PluginBridgeError extends Error {
|
package/dist/http.js
CHANGED
|
@@ -60,19 +60,21 @@ async function readResponse(response, mutation) {
|
|
|
60
60
|
raw = await response.json();
|
|
61
61
|
}
|
|
62
62
|
catch (cause) {
|
|
63
|
-
throw new PluginTransportError(
|
|
63
|
+
throw new PluginTransportError(response.ok && response.status >= 200 && response.status < 300
|
|
64
|
+
? `Plugin platform endpoint returned invalid JSON with HTTP ${response.status}`
|
|
65
|
+
: `Plugin platform endpoint rejected the request with HTTP ${response.status}`, cause, mutation ? "unknown" : undefined, response.status);
|
|
64
66
|
}
|
|
65
67
|
if (!isPlatformResponse(raw, mutation)) {
|
|
66
|
-
throw new PluginTransportError(`Plugin platform endpoint returned an invalid envelope with HTTP ${response.status}`, new PluginPlatformRequestError("PLUGIN_CONTRACT_MISMATCH", "Invalid platform response envelope"), mutation ? "unknown" : undefined);
|
|
68
|
+
throw new PluginTransportError(`Plugin platform endpoint returned an invalid envelope with HTTP ${response.status}`, new PluginPlatformRequestError("PLUGIN_CONTRACT_MISMATCH", "Invalid platform response envelope"), mutation ? "unknown" : undefined, response.status);
|
|
67
69
|
}
|
|
68
70
|
if (raw.ok) {
|
|
69
71
|
if (!response.ok || response.status !== 200) {
|
|
70
|
-
throw new PluginTransportError(`Plugin platform endpoint returned a success envelope with HTTP ${response.status}`, new PluginPlatformRequestError("PLUGIN_CONTRACT_MISMATCH", "HTTP status does not match the platform response envelope"), mutation ? "unknown" : undefined);
|
|
72
|
+
throw new PluginTransportError(`Plugin platform endpoint returned a success envelope with HTTP ${response.status}`, new PluginPlatformRequestError("PLUGIN_CONTRACT_MISMATCH", "HTTP status does not match the platform response envelope"), mutation ? "unknown" : undefined, response.status);
|
|
71
73
|
}
|
|
72
74
|
return raw.data;
|
|
73
75
|
}
|
|
74
76
|
if (response.ok || response.status === 200) {
|
|
75
|
-
throw new PluginTransportError(`Plugin platform endpoint returned an error envelope with HTTP ${response.status}`, new PluginPlatformRequestError("PLUGIN_CONTRACT_MISMATCH", "HTTP status does not match the platform response envelope"), mutation ? "unknown" : undefined);
|
|
77
|
+
throw new PluginTransportError(`Plugin platform endpoint returned an error envelope with HTTP ${response.status}`, new PluginPlatformRequestError("PLUGIN_CONTRACT_MISMATCH", "HTTP status does not match the platform response envelope"), mutation ? "unknown" : undefined, response.status);
|
|
76
78
|
}
|
|
77
79
|
{
|
|
78
80
|
throw new PluginPlatformRequestError(raw.error.code, raw.error.message || `Plugin platform endpoint failed with HTTP ${response.status}`, raw.error.details, "mutation_outcome" in raw.error ? raw.error.mutation_outcome : undefined);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/redevplugin-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@floegence/redevplugin-contracts": "3.0.
|
|
43
|
+
"@floegence/redevplugin-contracts": "3.0.16"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|