mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-10 17:30:51 +00:00
fix: add error reporting in datalake (#8535)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
a9b9690f5e
commit
5ac8c165da
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { MeasureContext } from '@hcengineering/core'
|
||||
import { type Request, type Response } from 'express'
|
||||
import { UploadedFile } from 'express-fileupload'
|
||||
@ -86,6 +87,7 @@ export async function handleBlobGet (
|
||||
if (err != null) {
|
||||
const error = err instanceof Error ? err.message : String(err)
|
||||
ctx.error('error writing response', { workspace, name, error })
|
||||
Analytics.handleError(err)
|
||||
if (!res.headersSent) {
|
||||
res.status(500).send('Internal Server Error')
|
||||
}
|
||||
@ -137,6 +139,7 @@ export async function handleBlobDelete (
|
||||
|
||||
res.status(204).send()
|
||||
} catch (error: any) {
|
||||
Analytics.handleError(error)
|
||||
ctx.error('failed to delete blob', { error })
|
||||
res.status(500).send()
|
||||
}
|
||||
@ -157,6 +160,7 @@ export async function handleBlobDeleteList (
|
||||
|
||||
res.status(204).send()
|
||||
} catch (error: any) {
|
||||
Analytics.handleError(error)
|
||||
ctx.error('failed to delete blobs', { error })
|
||||
res.status(500).send()
|
||||
}
|
||||
@ -175,6 +179,7 @@ export async function handleBlobSetParent (
|
||||
await datalake.setParent(ctx, workspace, name, parent)
|
||||
res.status(204).send()
|
||||
} catch (error: any) {
|
||||
Analytics.handleError(error)
|
||||
ctx.error('failed to delete blob', { error })
|
||||
res.status(500).send()
|
||||
}
|
||||
@ -211,6 +216,7 @@ export async function handleUploadFormData (
|
||||
sha256 =
|
||||
file.tempFilePath !== undefined ? await getFileSha256(file.tempFilePath) : await getBufferSha256(file.data)
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
const error = err instanceof Error ? err.message : String(err)
|
||||
ctx.error('failed to calculate file hash', { error })
|
||||
throw err
|
||||
@ -229,6 +235,7 @@ export async function handleUploadFormData (
|
||||
|
||||
return { key, metadata }
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
const error = err instanceof Error ? err.message : String(err)
|
||||
ctx.error('failed to upload blob', { error: err })
|
||||
return { key, error }
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { MeasureContext } from '@hcengineering/core'
|
||||
import { type Request, type Response } from 'express'
|
||||
import { createReadStream, createWriteStream } from 'fs'
|
||||
@ -110,6 +111,7 @@ export async function handleImageGet (
|
||||
|
||||
await writeFileToResponse(ctx, outFile, res)
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
ctx.error('image processing error', { workspace, name, error: err })
|
||||
|
||||
res.setHeader('Content-Type', blob.contentType)
|
||||
@ -237,6 +239,7 @@ async function writeFileToResponse (ctx: MeasureContext, path: string, res: Resp
|
||||
|
||||
pipeline(stream, res, (err) => {
|
||||
if (err != null) {
|
||||
Analytics.handleError(err)
|
||||
const error = err instanceof Error ? err.message : String(err)
|
||||
ctx.error('error writing response', { error })
|
||||
if (!res.headersSent) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { MeasureContext } from '@hcengineering/core'
|
||||
import { type Request, type Response } from 'express'
|
||||
|
||||
@ -46,6 +47,7 @@ export async function handleS3CreateBlob (
|
||||
await datalake.create(ctx, workspace, name, filename)
|
||||
res.status(200).send()
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
const error = err instanceof Error ? err.message : String(err)
|
||||
ctx.error('failed to create blob', { workspace, name, error })
|
||||
res.status(500).send()
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { systemAccountUuid, MeasureContext } from '@hcengineering/core'
|
||||
import { generateToken } from '@hcengineering/server-token'
|
||||
|
||||
@ -29,7 +30,8 @@ export async function requestHLS (ctx: MeasureContext, workspace: string, name:
|
||||
try {
|
||||
ctx.info('request for hls', { workspace, name })
|
||||
await postTranscodingTask(ctx, workspace, name)
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
ctx.error('can not schedule a task', { err })
|
||||
}
|
||||
}
|
||||
|
@ -229,6 +229,7 @@ export function createServer (ctx: MeasureContext, config: Config): { app: Expre
|
||||
return
|
||||
}
|
||||
|
||||
Analytics.handleError(err)
|
||||
res.status(500).json({ message: err.message?.length > 0 ? err.message : 'Internal Server Error' })
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user