UNPKG
tutorbook
Version:
latest (0.8.2)
0.8.2
0.7.9
Web app connecting students with expert mentors and tutors.
tutorbook.org
tutorbookapp/tutorbook
tutorbook
/
src
/
api
/
helpers
/
error.ts
12 lines
(10 loc)
•
278 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
{
NextApiResponse
}
from
'next'
;
export
default
function
error
(
res: NextApiResponse, msg: string, code =
400
, err?:
Error
):
void
{
console
.
error
(
`[ERROR] Sending client
${code}
with msg (
${msg}
)...`
, err); res.
status
(code).
send
({ msg, ...(err || {}) }); }