System Information
- Strapi Version: 4.20
- Operating System: darwin arm64
- Database: MySQL2
- Node Version: 20.11
- Yarn Version: 1.22
-Edition: Community
Updating from v4.13 → 4.20
I have a file that imports “formatApplicationError”.
Since v4.20 the import is giving an error.
What it the new way to import formatApplicationError in strapi v4.20?
The import has the following format.
const {
formatApplicationError,
formatHttpError,
} = require(“@strapi/strapi/lib/services/errors”);
--------Here the error stack--------------------------------
Cannot find module ‘@strapi/strapi/lib/services/errors’ from ‘src/middlewares/errors.js’
Require stack:
src/middlewares/errors.js
node_modules/@strapi/utils/dist/index.js
node_modules/@strapi/database/dist/index.js
node_modules/@strapi/strapi/dist/Strapi.js
node_modules/@strapi/strapi/dist/index.js
tests/helpers/strapi.ts
tests/helpers/index.ts
tests/plugins/user-permissions.test.ts
3 | formatApplicationError,
4 | formatHttpError,
5 | } = require(“@strapi/strapi/lib/services/errors”);
| ^
6 |
We know in v4.20 the Library “strapi/strapi/lib/services/errors” is not exporting formatApplicationError.
What it the new way to import formatApplicationError in strapi v4.20?