MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / decodePrpcError

Function decodePrpcError

vmm/ui/src/lib/vmmRpcClient.ts:11–28  ·  view source on GitHub ↗
(buffer: Uint8Array)

Source from the content-addressed store, hash-verified

9let cachedClient: any;
10
11function decodePrpcError(buffer: Uint8Array) {
12 try {
13 if (buffer && buffer.length > 0) {
14 const err = prpc.PrpcError.decode(buffer);
15 if (err?.message) {
16 return err.message;
17 }
18 }
19 } catch {
20 // Ignore decode failures; fall through to text decoding.
21 }
22 try {
23 const text = buffer && buffer.length > 0 ? textDecoder.decode(buffer) : '';
24 return text || 'Unknown RPC error';
25 } catch {
26 return 'Unknown RPC error';
27 }
28}
29
30function normalizeRequestData(data?: Uint8Array | ArrayBuffer | null) {
31 if (!data) {

Callers 1

rpcImplFunction · 0.85

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected