DELAPARRA
Index
Color
NL
Category: Error types

RuntimeError

Explained by Updated

What is RuntimeError?

RuntimeError: A general catch-all error category raised when something goes wrong during execution that doesn't fit a more specific type. RuntimeError is a general error type for problems that happen while a program runs and do not fit a more specific category. Python raises it for various unexpected situations, and PHP has RuntimeException as a base for errors that can only be detected at runtime.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about RuntimeError

How is RuntimeError used in practice?

Because it is so general, the message carries most of the information. Read it carefully, and look at the stack trace to see where it came from.

What should you keep in mind with RuntimeError?

When you throw errors in your own code, prefer specific exception classes, such as PaymentDeclinedException or InvoiceAlreadySentException. Callers can then catch exactly the problems they know how to handle, and your logs say clearly what went wrong. Catching every RuntimeException broadly tends to hide bugs that should have been fixed.

At a glance

CategoryError types
Explained by
Updated

More Error types terms

All terms starting with R

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.