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.

[Error-Handling]: instructions are unclear, and wrong programs pass the tests

See original GitHub issue

I just did the error-handling exercise, and had several issues:

  • It was unclear at first what to do with inputs. Looking at the tests, it seemed that trying to convert the input to int was the right thing to try, but this is not mentioned in the readme or the stubs.
  • The test for whether a method throws an exception will pass any error that might occur, not just if it’s intentionally raised:
def handle_error_by_throwing_exception():
    raise "(╯°□°)╯︵ ┻━┻"  # Raising a string is a TypeError, but passes the test
  • When returning a tuple, which element should be the result and which one the status? What should the result element be when it fails? No suggestion
  • No mention of advantages or disadvantages of the different kinds of error handling, or what is idiomatic Python.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
cmccandlesscommented, Mar 8, 2020

The entire error-handling exercise is a bit problematic in its current implementation. It will likely be replaced with a proper Concept Exercise in v3.

1reaction
BethanyGcommented, Jan 19, 2021

@cmccandless – I think this would be good to leave open as a reminder. Otherwise, it might get lost in the shuffle.

Ultimately, we want to log both the error-handling concept exercise issues and a re-write of this practice exercise as its own issue, but I don’t have time atm to do so – so I think the best bet is to leave this pending.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clean Code and the Art of Exception Handling - Toptal
Exception Handling : It's a Good Thing · Always create your own ApplicationError hierarchy · Never rescue Exception · Never rescue more exceptions...
Read more >
Error Messages: Examples, Best Practices & Common Mistakes
4 common mistakes with error messages · 1. Ambiguity · 2. Condescending language/blaming the user · 3. Poor placement of error messages ·...
Read more >
Errors and exceptions - Object-Oriented Programming in Python
Errors or mistakes in a program are often referred to as bugs. They are almost always the fault of the programmer. The process...
Read more >
Exceptions and Error Handling, C++ FAQ - Standard C++
The basic answer is: Using exceptions for error handling makes your code simpler, cleaner, and less likely to miss errors. But what's wrong...
Read more >
What is Exception Handling? - SearchSoftwareQuality
Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events...
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