Feedback on Using Effect for URL Hash Verification Task
As mentioned before, I am an Effect noob and I would appreciate feedback/code review
I am rewriting one of ours internal project to see how to utilize effect.
The problem is as follows: given config, iterate over each URL defined there, calculate it's hash (just sha256 of content) and verify if it matches to one of the expected hashes (from config). If not, return/raise error.
This is what I ended doing:
I have multiple questions:
1. Initially I was calculating hashes first (
2. Generally speaking I tend to use raw arrays, is this wrong? Should everything be wrapped in effect?
3. Error handling is cumbersome. I want to log http errors and simply ignore them. Here I needed to return undefined to filter these errors. Is there a better way?
Thanks again for all the help!
The problem is as follows: given config, iterate over each URL defined there, calculate it's hash (just sha256 of content) and verify if it matches to one of the expected hashes (from config). If not, return/raise error.
This is what I ended doing:
I have multiple questions:
1. Initially I was calculating hashes first (
const hashes = yield * Effect.all(...)) . Then I wanted to zip hashes with original config object but i realised there is no zip utility in effect which probably means I approched the problem from wrong direction.2. Generally speaking I tend to use raw arrays, is this wrong? Should everything be wrapped in effect?
3. Error handling is cumbersome. I want to log http errors and simply ignore them. Here I needed to return undefined to filter these errors. Is there a better way?
Thanks again for all the help!
