Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/blobs/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getTracer, withActiveSpan } from '@netlify/otel'
import { SpanStatusCode } from '@netlify/otel/opentelemetry'
import { ListResponse, ListResponseBlob } from './backend/list.ts'
import { Client, type Conditions } from './client.ts'
import type { ConsistencyMode } from './consistency.ts'
Expand Down Expand Up @@ -179,10 +180,12 @@ export class Store {
})

if (res.status === 404) {
span?.setStatus({ code: SpanStatusCode.ERROR })
return null
}

if (res.status !== 200) {
span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
}

Expand All @@ -207,6 +210,7 @@ export class Store {
return res.body
}

span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
})
}
Expand All @@ -225,10 +229,12 @@ export class Store {
})

if (res.status === 404) {
span?.setStatus({ code: SpanStatusCode.ERROR })
return null
}

if (res.status !== 200 && res.status !== 304) {
span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
}

Expand Down Expand Up @@ -310,10 +316,12 @@ export class Store {
})

if (res.status === 404) {
span?.setStatus({ code: SpanStatusCode.ERROR })
return null
}

if (res.status !== 200 && res.status !== 304) {
span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
}

Expand Down Expand Up @@ -422,6 +430,7 @@ export class Store {
}
}

span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
})
}
Expand Down Expand Up @@ -469,6 +478,7 @@ export class Store {
}
}

span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
})
}
Expand Down Expand Up @@ -603,6 +613,7 @@ export class Store {
let directories: string[] = []

if (![200, 204, 404].includes(res.status)) {
span?.setStatus({ code: SpanStatusCode.ERROR })
throw new BlobsInternalError(res)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/blobs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"allowImportingTsExtensions": true,
"emitDeclarationOnly": true,
"target": "ES2020",
"module": "es2020",
"module": "nodenext",
"allowJs": true,
"declaration": true,
"declarationMap": false,
"sourceMap": false,
"outDir": "./dist",
"removeComments": false,
"strict": true,
"moduleResolution": "node",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
Expand Down