Skip to content

Package will throw under Express v5 #28

Description

@jonchurch

Hey there! Wanted to give you some heads up that express v5 should be getting released sometime next month.

Version 5 will support returning promises from route handlers. But there have also been changes specifically to Router which will make this package throw a fatal error currently. Both Layer and Router are no longer able to be deep required through require('express/lib/router). Router has been moved into its own package at pillarjs/router and is used as a dep of express.

I'd suggest maybe checking the version of Express that is being used when users require this module and printing a deprecation notice or something similar to avoid crashes.

const {version: expressVersion} = require('express/package.json');

if (expressVersion[0] > 4) {
	console.log(`deprecated: express-async-errors works with version 4 of Express, you are using ${expressVersion} which supports async route handlers natively`)
} else {
	// setup module
}

I've used your package a bunch in the past, so thank you for creating it ❤️

If there's anything I can do to help or answer any questions about v5, please let me know.

To test out the latest release candidates of Express before v5 is released into main, you can npm i express@next.

P.S. I see that you've also promisified Router.param which I'm not 100% sure is coming to Express v5. I'll have to check on that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions