# Is there any difference in how exceptions are handled under the hood between 'try?' and 'do/catch'?

**URL:** <https://forums.swift.org/t/is-there-any-difference-in-how-exceptions-are-handled-under-the-hood-between-try-and-do-catch/68104>\
**Category:** Using Swift\
**Tags:** try, exceptions, do-catch\
**Created:** [October 27, 2023, 12:39pm UTC](https://forums.swift.org/t/is-there-any-difference-in-how-exceptions-are-handled-under-the-hood-between-try-and-do-catch/68104 "2023-10-27T12:39:37Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![phoneyDev](https://avatars.discourse-cdn.com/v4/letter/p/49beb7/32.png) [@phoneyDev](https://forums.swift.org/u/phoneyDev)\
**Post date:** [October 29, 2023, 4:17pm UTC](https://forums.swift.org/t/is-there-any-difference-in-how-exceptions-are-handled-under-the-hood-between-try-and-do-catch/68104/5 "2023-10-29T16:17:30Z")

</div>

Swift code can't catch Obj-C exceptions and a swift app will crash if an Obj-C exception finds its way into swift code. See for instance:

> [@Catching NSException](https://forums.swift.org/t/catching-nsexception/1937):
>
> Apologies if this has come up before - I've fallen behind in following this list. I recently ran into an issue where I needed to be able to catch NSExceptions raised by Objective C API in Swift, and found no good way to do that. Currently the only possible way is to via Objective C code that wraps the call in an Objective C style @try/@catch block. If building a swift framework, this means a separate module, since we can't use bridging headers. My quick attempt at a workaround can be s…

> [@A tricky situation that the language seems to have no support for. (Exceptions, Extensions, Properties)](https://forums.swift.org/t/a-tricky-situation-that-the-language-seems-to-have-no-support-for-exceptions-extensions-properties/10547):
>
> Try this in an iOS/macOS SpriteKit project: let spriteSize = CGSize(width: 32, height: 32) let sprite1 = SKSpriteNode(color: .red, size: spriteSize) let sprite2 = SKSpriteNode(color: .green, size: spriteSize) let physicsBody1 = SKPhysicsBody(rectangleOf: spriteSize) sprite1.physicsBody = physicsBody1 scene.addChild(sprite1) sprite2.physicsBody = physicsBody1 scene.addChild(sprite2) It will crash during runtime: Terminating app due to uncaugh…

> [@Why are FileHandle methods deprecated without warnings, and how do I show the warnings?](https://forums.swift.org/t/why-are-filehandle-methods-deprecated-without-warnings-and-how-do-i-show-the-warnings/53930/3):
>
> Just a point of clarification here: they can trigger exceptions, but aren't marked with throw You’re comparing apples to oranges here. The exceptions thrown by these legacy APIs are Objective-C language exceptions [1]. There are very different from Swift errors and Swift can’t deal with them at all. The Objective-C equivalent of a Swift error is an NSError output parameter. Share and Enjoy Quinn “The Eskimo!” @ DTS @ Apple [1] On most platforms such exceptions are equivalent to C++ exc…

Nothing has changed.

---

_[View the full topic](https://forums.swift.org/t/is-there-any-difference-in-how-exceptions-are-handled-under-the-hood-between-try-and-do-catch/68104)._
