Skip to content

Remove IntegerDivisionByZeroException #30743

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

Open
lrhn opened this issue Sep 15, 2017 · 5 comments
Open

Remove IntegerDivisionByZeroException #30743

lrhn opened this issue Sep 15, 2017 · 5 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-2 library-core type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable

Comments

@lrhn
Copy link
Member

lrhn commented Sep 15, 2017

Just make it an ArgumentError. It doesn't deserve its own class.

@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-m library-core labels Sep 15, 2017
@floitschG floitschG added core-2 and removed core-m labels Sep 18, 2017
@srawlins
Copy link
Member

Should we mark IntegerDivisionByZeroException deprecated so we can delete in Dart 3 without fanfare?

@lrhn
Copy link
Member Author

lrhn commented May 16, 2019

I still think we should, but it's not decided that it's worth the pain.

@lrhn
Copy link
Member Author

lrhn commented Feb 11, 2022

The class is now deprecated, but not removed.

@lrhn lrhn added the type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable label Mar 4, 2022
@leafpetersen
Copy link
Member

Should we stop using this in the core libraries now, or do you propose to make that switch later?

@lrhn
Copy link
Member Author

lrhn commented Apr 15, 2022

The current state throws an IntegerDivisionByZeroException which implements StateError and Exception.
That makes it backwards compatible (anyone catching IntegerDivisionByZeroException or Exception will still catch it.
They will get warning if using IntegerDivisionByZeroException, but not if just catching Exception.
Because of that, it would be nice to stop throwing an Exception entirely.

Our breaking-change policy makes it a breaking change to change the throw-behavior of something unless it throws an Error, and it used to be just an Exception, so we probably do have to go through the breaking change process.
I think it'll be a painless breaking change (except for some amount of tests that change behavior - I highly doubt anyone ever catches that exception outside of tests.

We can go for an intermediate state where IntegerDivisionByZeroException becomes a (deprecated) type alias for StateError.
That will keep code working, but stop actually having the class.

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. core-2 library-core type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable
Projects
None yet
Development

No branches or pull requests

4 participants