chore(server): added functional flavour to error helpers

This commit is contained in:
Roberto Tonino
2021-04-25 00:03:57 +02:00
parent 2433209676
commit 57987a83d0
5 changed files with 61 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ import { RequestHandler } from 'express'
import { ApiHandler } from '../../../types'
import { dz } from '../../../main'
import { isObjectEmpy } from '../../../helpers/primitive-checks'
import { BadRequestError, consoleError, isBadRequestError } from '../../../helpers/errors'
import { BadRequestError, isBadRequestError, consoleError } from '../../../helpers/errors'
export interface RawChartTracksQuery {
id: string
@@ -27,7 +27,7 @@ const handler: RequestHandler<{}, {}, {}, RawChartTracksQuery> = async (req, res
next()
} catch (error) {
if (isBadRequestError(error)) {
consoleError(error.message)
consoleError(error.message).unsafePerformIO()
res.status(400).send()
return next()
}