Skip to content

Define common supertype for runtime errors #7000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
munificent opened this issue Nov 28, 2012 · 2 comments
Closed

Define common supertype for runtime errors #7000

munificent opened this issue Nov 28, 2012 · 2 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-as-intended Closed as the reported issue is expected behavior type-enhancement A request for a change that isn't a bug

Comments

@munificent
Copy link
Member

You can roughly bucket errors into three groups:

  1. Programmatic errors: ArgumentError, StateError, etc.
  2. System errors: StackOverflow, OutOfMemory, etc.
  3. Runtime errors: FormatException, ProcessException, etc.

Occasionally, I find myself wanting to catch all possible runtime errors. (For example, so I can clean up or log on failure.) In those cases, it still feels weird to catch programmatic errors like ArgumentError.

Have you considered having something like:

class Error {} // base class for everything
class Exception extends Error {} // just runtime errors

@lrhn
Copy link
Member

lrhn commented Nov 28, 2012

You can already catch Exception, which is a supertype of the "Runtime errors".
It's not an Error, though.
Is there something you want to do that you can't just catching Exception?

Distinguishing programmatic errors and system errors is mostly academic, since you are not expected to catch either (unless you are doing fail-safe code, and then you catch everything, not just Exception and Error).


Added NeedsInfo label.

@munificent
Copy link
Member Author

Ah, I didn't realize the exception classes were already set up that way. Everything's fine then. :)


Added AsDesigned label.

@munificent munificent added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-as-intended Closed as the reported issue is expected behavior labels Nov 28, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-as-intended Closed as the reported issue is expected behavior type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants