question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[exercises/concept/fruit-picker] Exercise requires users to be familiar with the throw statement

See original GitHub issue

While I was doing the exercise myself (which is made to test users about the Arrow functions and Callbacks concepts), I came across something that I found a bit confusing: task 3 of this exercise requires users to

[…] throw a new error if err is not null.

This implies using the javascript throw statement as part of the function the exercise asks you to build. However, the Errors concept (where the throwstatement is developed) is to be found much further down the syllabus tree, and the way the instruction is described in the task might make users think that “throwing an error” just means returning a string with an message with an error text as opposed to using the error statement. This is what I did myself, which meant that when running the tests, I got a message from the debugger saying that I was supposed to use something I didn’t even know existed to complete the exercise.

I believe this can be easily fixed by either:

  • Making sure the instruction of the task is clear about what the user needs to use (the errorstatement). An easy fix to this would be to add a link to its MDN page in the very same paragraph.
  • Removing the need to use such statement. This would imply modifying the exercise so that users are required to simply return a string with an error message instead.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sergioreynosocommented, Mar 2, 2022

Hello, in Task 3 it says “Finish the purchaseInventoryIfAvailable callback function to be used with the grocer’s checkInventory API function.”, but the checkInventory callback takes a query and a callback. I’m confused as to how I’m to use checkInventory in this exercise.

1reaction
junedevcommented, Apr 12, 2022

@pikkus I agree the introduction could probably be improved. I am not sure what would be gained by decoupling callbacks from arrow functions though. You are already free to choose to not do the Callbacks exercise but instead first proceed down the Classes path in the syllabus. But in the end callbacks are needed to understand all of the array utilities (map, forEach, filter, etc.) in the next “layer” of the concept tree and those are also one of the most common use cases for arrow functions and one reason arrow functions were added to the language. That’s why I think it makes sense to learn about callbacks and arrow functions in the same exercise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Health Checker v2 - Visual C++ Redistributable Version Check
[exercises/concept/fruit-picker] Exercise requires users to be familiar with the throw statement, 7, 2022-01-22, 2022-10-04.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found