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

Function parseStorageError

src/main/api/routes/http-requests.ts:15–31  ·  view source on GitHub ↗
(
  error: unknown,
)

Source from the content-addressed store, hash-verified

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

Callers 1

mapStorageErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected