@astrale-os/sdk 0.5.0-beta.32 → 0.5.0-beta.34
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
2
2
|
import { ClientError, MissError, ProtocolError as ClientProtocolError, ResponseError, SessionError, StaleRouteError, TransportError, } from '../../../platform/client/index.js';
|
|
3
3
|
const PUBLIC_DIAGNOSTICS = new Set(['VALUE_SCHEMA_INSTANCE_INVALID', 'VS_NUMBER_DOMAIN']);
|
|
4
|
+
const PUBLIC_ERROR_CODES = new Set(Object.values(errors.CODES));
|
|
4
5
|
const MAXIMUM_DIAGNOSTICS = 32;
|
|
5
6
|
export class InvocationError extends Error {
|
|
6
7
|
code;
|
|
@@ -56,6 +57,9 @@ export function projectError(input) {
|
|
|
56
57
|
if (input instanceof InvocationError)
|
|
57
58
|
return protocolError(input.code, input.message, input.reason);
|
|
58
59
|
if (input instanceof ResponseError) {
|
|
60
|
+
if (!PUBLIC_ERROR_CODES.has(input.code)) {
|
|
61
|
+
return protocolError('BACKEND_UNAVAILABLE', 'Dependency Kernel returned invalid error evidence.');
|
|
62
|
+
}
|
|
59
63
|
return new errors.ProtocolError({
|
|
60
64
|
code: input.code,
|
|
61
65
|
message: input.message,
|