Open Bug 1693389 Opened 4 years ago Updated 4 years ago

[meta] Convert all objective C exception guards to the fatal / aborting versions

Categories

(Core :: Widget: Cocoa, task)

All
macOS
task

Tracking

()

People

(Reporter: mstange, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: meta)

At the moment, we have NS_OBJC_BEGIN/END_TRY_IGNORE_BLOCK and NS_OBJC_BEGIN/END_TRY_BLOCK_RETURN macros strewn over much of our Objective C(++) code.

These macros catch Objective C exceptions and then proceed with execution. This means that our code needs to be written with "partial execution" in mind, i.e. we need to think about the program states that we get into if the rest of the function gets skipped due to an exception.

This is an unsafe default. It also makes refactoring harder because one has to think about more failure states.
Early "abandonment" (crashing) is ultimately safer and easier to work with.

We should convert all our exception guards to the "fatal" versions: NS_OBJC_BEGIN_TRY_ABORT_BLOCK + NS_OBJC_END_TRY_ABORT_BLOCK. This means that we will crash on all unexpected objective C exceptions.
From the crash reports, we will be able to tell which exceptions can occur in practice, and we can treat them as "expected" exceptions or change our code such that the exceptions are no longer triggered.

For "expected" exceptions, we should wrap the appropriate calls in manual, tightly-scoped @try {...} @catch (...) {...} blocks.

This bug tracks converting our code base to the fatal exception guards. We can do it piece by piece, so that we have some time to react to any new crash reports.

OS: Unspecified → macOS
Hardware: Unspecified → All
Version: unspecified → Trunk
Depends on: 1692401
Type: defect → task
Depends on: 1692647
No longer blocks: 1692375
Depends on: 1692375
You need to log in before you can comment on or make changes to this bug.