-
-
Notifications
You must be signed in to change notification settings - Fork 659
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work with the Browser Test Runner, but the idea is not wrong. I can help come up with an easy alternative to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, thank you
@BNAndras
BNAndras
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not a track maintainer here, just a friendly maintainer from elsewhere on Exercism. I made some more general comments, but whatever SleeplessBytes and Cool-Kat say is the final word. :)
...r-handling.spec.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's there is almost done. The only issue I have is that this isn't actually handling any error!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all other stubs we throw new Error('...') (I don't recall the exact error message). We probably want to use that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We almost always want a message in an error. We don't need to test the exact message, but throwing an empty error is non-idiomatic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll add that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We almost always want a message in an error. We don't need to test the exact message, but throwing an empty error is non-idiomatic.
Co-authored-by: Derk-Jan Karrenbeld <derk-jan+github@karrenbeld.info>
A-O-Emmanuel
commented
Aug 26, 2025
Hi @SleeplessByte thanks for your review, sorry it took this long for me to reply, just to clarify, when you say "The only issue I have is that this isn't actually handling any error!" do you mean that the function should include descriptive error messages rather than handling more complex error scenarios?
SleeplessByte
commented
Aug 28, 2025
@A-O-Emmanuel no worries! We are not in a hurry.
Right now, the exercise wants you to throw errors. It doesn't want you to handle the error.
Handling errors could be:
try { } catch { }
or
promise.catch(...)
or
try { } finally { }
or
promise.finally(...)
A-O-Emmanuel
commented
Aug 28, 2025
Oh, that's true, I'll just have to revert back to the way I did it before. Thanks for the clarification, I've learnt something today, "throwing errors and handling errors" are two different things, yeah, it makes sense, thank you.
SleeplessByte
commented
Oct 16, 2025
@Cool-Katt how do you feel about this?
Cool-Katt
commented
Oct 16, 2025
I was kinda out of the loop on this one so I can review in more depth tomorrow, but preliminary assessment is that I would have liked to see a couple of more tests.
I'll probably have to get up to speed first tho, to comment more
A-O-Emmanuel
commented
Oct 27, 2025
Hi @Cool-Katt, okay I will add more tests, but I'll wait for your final assessment before adding more tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way this currently is, it'll pass one of the tests by default, without the student changing anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk if i'm vibing with this test specifically, maybe we need to add some handling for the empty string case, instead of throwing error.
In any case, more tests are needed, like for example do we want the tests to pass with any generic Error type or do we want to allow only certain types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line probably needs to be removed, or at least changed because it's generic from the problem-spec repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about on empty string, instead of throwing, it returns 'INVALID' or null/undefined so we can add some handling too.
we can also explicitly forbid the generic Error type to add more complexity
Cool-Katt
commented
Oct 29, 2025
Right, sorry folks, real life got in the way. Anyway.
The way I see it, currently its a good effort but i'd maybe like to see some more restrictions/explicit handling scenarios. It also definitely needs more tests and maybe a rewrite of the instructions.
A-O-Emmanuel
commented
Nov 9, 2025
Okay @Cool-Katt, thanks, just got the chance to look at your comments, been really occupied, but I should be free ending of next week to start implementing your suggestions, thank you.
...m/A-O-Emmanuel/javascript into implement-error-handling-exercise Merge remote branch with local branch;
A-O-Emmanuel
commented
Dec 28, 2025
hi @Cool-Katt I've made changes and added more tests, please review, and sorry for the delay.
Implemented the Error Handling practice exercise with solution, tests, and documentation