About 689,000 results
Open links in new tab
  1. Why are Python exceptions named "Error"? - Stack Overflow

    Q. Why are Python exceptions named “Error”? I surmise this is because most Python exceptions are classified as either errors or warnings. If the names of Python exceptions were to end with …

  2. python exception handling - Stack Overflow

    Jan 4, 2011 · There are various ways to format the exception, the logging module (which I assume you/Django uses) has support to format exceptions, and the exceptions themselves …

  3. Manually raising (throwing) an exception in Python - Stack Overflow

    Jun 13, 2022 · How do I manually throw/raise an exception in Python? Use the most specific Exception constructor that semantically fits your issue. Be specific in your message, e.g.: raise …

  4. Correct way of handling exceptions in Python? - Stack Overflow

    Aug 17, 2009 · My question is, how to handle exceptions nicely, ones that depend on one another, meaning: Only if the first step was successful, try the next, and so on. One more …

  5. python - Should I always specify an exception type in `except ...

    Dec 29, 2015 · It's almost always better to specify an explicit exception type. If you use a naked except: clause, you might end up catching exceptions other than the ones you expect to catch …

  6. Why is the source code of the Python logging module ... - Stack Overflow

    Jan 23, 2019 · This means: if sys._getframe() exists in the Python implementation, return the 3rd frame object from the top of the call stack. If sys does not have this function as an attribute, …

  7. Built-in ExceptionsPython 3.13.3 documentation

    2 days ago · In Python, all exceptions must be instances of a class that derives from BaseException. In a try statement with an except clause that mentions a particular class, that …

  8. Proper way to declare custom exceptions in modern Python? - Stack Overflow

    Dec 17, 2013 · With modern Python Exceptions, you don't need to abuse .message, or override .__str__() or .__repr__() or any of it. If all you want is an informative message when your …

  9. Best Practices for Python Exceptions? - Stack Overflow

    Exceptions exist for exceptional situations: events that are not a part of normal execution. Consider 'find' on a string returning -1 if the pattern isn't found, but indexing beyond the end of …

  10. Why do I get inconsistent exceptions on Python? - Stack Overflow

    Oct 3, 2010 · I would suggest that you don't depend on the string representation of the exception; you might name it msg, but it's neither a string nor a message; it's an exception instance. So …

  11. Some results have been removed
Refresh