MCPcopy Index your code
hub / github.com/massCodeIO/massCode / parseStorageError

Function parseStorageError

src/main/api/routes/captures.ts:27–43  ·  view source on GitHub ↗
(
  error: unknown,
)

Source from the content-addressed store, hash-verified

25])
26
27function parseStorageError(
28 error: unknown,
29): { code: string, message: string } | null {
30 if (!(error instanceof Error)) {
31 return null
32 }
33
34 const separatorIndex = error.message.indexOf(':')
35 if (separatorIndex <= 0) {
36 return null
37 }
38
39 return {
40 code: error.message.slice(0, separatorIndex),
41 message: error.message.slice(separatorIndex + 1).trim(),
42 }
43}
44
45function mapStorageError(status: unknown, error: unknown): never {
46 const setStatus = status as (

Callers 1

mapStorageErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected