RuntimeError
Built-in ExceptionPython 2.0+Intermediate
Raised when an error doesn't fit any other category
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
# Triggering and catching RuntimeError try: raise RuntimeError("runtime error occurred") except RuntimeError as e: print(f"Caught RuntimeError: {e}") print(f"Type: {type(e).__name__}")
RuntimeError is raised when raised when an error doesn't fit any other category. Always catch specific exceptions rather than bare except clauses.
Try in PlaygroundTags
exceptionerror-handlingcore