Search code examples
xcodecombine

Where is the message passed to Combine's `assertFatalError` printed?


When a fatal error is triggered by assertFatalError(_file:line:) in a Combine pipeline, where is the message provided to its first argument printed?

I've got a pipeline that includes (e.g.):

.assertFatalError("Bad thing number 6 happened")

…but nowhere in the debug console (nor elsewhere in Xcode that I've yet found) am I seeing the string, "Bad thing number 6 happened" when this error is asserted. Just an EXC_BAD_INSTRUCTION that I wouldn't recognize out of context.


Solution

  • According to this thread they're supposed to be in the crash log:

    https://forums.swift.org/t/intercept-fatalerror-or-other-termination-messages-from-swift/6190

    But they note:

    Unfortunately, it looks like iOS on-device prunes the application-specific info from crash logs because of user privacy concerns. The crash reason does show up in macOS or simulator crash logs, however.

    There was further discussion in 2019 through to 2022 about making the messages easier to get to:

    https://forums.swift.org/t/stdlib-cleanup-callback-for-fatal-swift-errors/26977/26

    But I don't see any resolution