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

Function parseStorageError

src/main/api/routes/http-folders.ts:9–25  ·  view source on GitHub ↗
(
  error: unknown,
)

Source from the content-addressed store, hash-verified

7const app = new Elysia({ prefix: '/http-folders' })
8
9function parseStorageError(
10 error: unknown,
11): { code: string, message: string } | null {
12 if (!(error instanceof Error)) {
13 return null
14 }
15
16 const separatorIndex = error.message.indexOf(':')
17 if (separatorIndex <= 0) {
18 return null
19 }
20
21 return {
22 code: error.message.slice(0, separatorIndex),
23 message: error.message.slice(separatorIndex + 1).trim(),
24 }
25}
26
27function mapStorageError(status: unknown, error: unknown): never {
28 const setStatus = status as (

Callers 1

mapStorageErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected