Skip to content

How to catch error throw in the middleware? #22

@raphaelsoul

Description

@raphaelsoul

Just set file size limit can server throws an error with 500 status code.

I need to catch Error:File too large` and throw 416 code.

router.post('/upload', upload.single('file'), async ctx => {
    // how to catch error here ?
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions