8000 Improve `s.u.Using` suppression order by NthPortal · Pull Request #11000 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

Improve s.u.Using suppression order #11000

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

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/library/scala/util/Using.scala
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ import scala.util.control.{ControlThrowable, NonFatal}
* - `java.lang.LinkageError`
* - `java.lang.InterruptedException` and `java.lang.ThreadDeath`
* - [[scala.util.control.NonFatal fatal exceptions]], excluding `scala.util.control.ControlThrowable`
* - all other exceptions, excluding `scala.util.control.ControlThrowable`
* - `scala.util.control.ControlThrowable`
* - all other exceptions
*
* When more than two exceptions are thrown, the first two are combined and
* re-thrown as described above, and each successive exception thrown is combined
Expand Down Expand Up @@ -265,9 +265,9 @@ object Using {
case _: VirtualMachineError => 4
case _: LinkageError => 3
case _: InterruptedException | _: ThreadDeath => 2
case _: ControlThrowable => 0
case _: ControlThrowable => -1 // below everything
case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal
case _ => -1
case _ => 0
}
@inline def suppress(t: Throwable, suppressed: Throwable): Throwable = { t.addSuppressed(suppressed); t }

Expand Down
Loading
0