in c++,
It's for logic errors of the class of "domain" errors. This could apply to any situation where the input to a function exceeds the allowable domain for it to operate on. That's its stated purpose in the standard.
For example, you have a function that takes only positive floats, so it throws a domain_error for negative numbers.