Reputation: 456
Is there any equivalent to EnvironmentError
from python in java? Example follows:
raise EnvironmentError
Upvotes: 0
Views: 77
Reputation: 106390
With Java we take a rather myopic point of view and assume that we are in control of virtually every error that can come up (in the case of anything that is an Exception
), or we assume that this is the result of some extraneous behavior (RuntimeException
). However, both of those exceptions are still within some realm of our control.
The one thing that happens that's outside of our control are Error
s. Y'know, things like running out of memory would be well outside of our control. Since EnvironmentError
deals with errors outside the purview of Python, I would believe that Error
is its Java counterpart in spirit.
In practice, it's likely closer to an Exception
, given that it deals with OSError
and IOError
(and those are things that Java believes it can recover from, for the most part).
Upvotes: 3