Weekly Swift articles, podcasts and tips by John Sundell.

Using a custom exception handler

Published on 16 Oct 2018
Basics article available: Error Handling

It's cool that you can easily assign a closure as a custom NSException handler. This is super useful when building things in Playgrounds - since you can't use breakpoints - so instead of just signal SIGABRT, you'll get the full exception description if something goes wrong.

NSSetUncaughtExceptionHandler { exception in
    print(exception)
}