We are restructuring the error handling as per discussed RFC, starting with CollectionPageService
Closes IS-212
Solution
This PR introduces named parameters for Base Isomer Error. Eventually all the errors should have this, but base error seemed to have the smallest surface area for a initial PR. But because of this change, all "child" classes of the base error will have a small change in their constructors where super(...) is called.
We are introducing new fields to the existing error classes - meta, code, isV2err, componentCode and fileCode.
The error handler is also doing a conditional check to convert the internal representation to external facing. For now, the external rep is just a combination of the componentCode-fileCode-code.
As the initial PR, I have modified CollectionPageService.js to this new format.
The errors are thrown when the filename has special characters in them. However, these are already caught on FE. To simulate the BE response you need to copy a successful network request as a cURL and use Postman/Insomnia to import that and manually send a invalid file name in the body
The return response's code should be of format componentCode-fileCode-code.
In the event where a invalid filename request is sent from FE, returning the new external rep format will be handled by FE. As tested (by disabling validation on FE) - check this PR: https://github.com/isomerpages/isomercms-frontend/pull/1312
Problem
We are restructuring the error handling as per discussed RFC, starting with CollectionPageService
Closes IS-212
Solution
This PR introduces named parameters for Base Isomer Error. Eventually all the errors should have this, but base error seemed to have the smallest surface area for a initial PR. But because of this change, all "child" classes of the base error will have a small change in their constructors where
super(...)
is called.We are introducing new fields to the existing error classes -
meta
,code
,isV2err
,componentCode
andfileCode
.The error handler is also doing a conditional check to convert the internal representation to external facing. For now, the external rep is just a combination of the
componentCode-fileCode-code
.As the initial PR, I have modified CollectionPageService.js to this new format.
Breaking Changes
Tests
Run
npm run test
to ensure all tests are passing.CollectionPageService is used within the workspace folder when you try to create or rename a folder. Example: http://localhost:3000/sites/{some-site}/folders/example-folder
The errors are thrown when the filename has special characters in them. However, these are already caught on FE. To simulate the BE response you need to copy a successful network request as a cURL and use Postman/Insomnia to import that and manually send a invalid file name in the body
The return response's code should be of format
componentCode-fileCode-code
.In the event where a invalid filename request is sent from FE, returning the new external rep format will be handled by FE. As tested (by disabling validation on FE) - check this PR: https://github.com/isomerpages/isomercms-frontend/pull/1312
Deploy notes
To deploy together with FE PR - https://github.com/isomerpages/isomercms-frontend/pull/1312