Skip to content

Conversation

@dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Dec 6, 2025

What?

Log exceptions from failed plugin loading and editor initialization.

Why?

Ref CMM-887. Improve failure observability.

How?

  • Log handled plugin load failures.
  • Log handled editor initialization failures.
  • Always set the stacktrace value for exceptions sent across the bridge.

Testing Instructions

  1. Remove the demo editor app from your testing device to clear cached editor assets.
  2. Block the editor assets endpoint via Proxyman or some other mechanism.
  3. Run the demo editor app on your device.
  4. Open the editor for a site with the Jetpack plugin activated.
  5. Note the warning toast message: Plugin loading failed, using default editor configuration.
  6. Verify the logged exception arrives in the host app via a breakpoint—e.g., ios/Demo-iOS/Sources/Views/EditorView.swift:163.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.

Logging these exceptions will improve the ability to act upon them and
improve stability.
Ensure early logs are evaluated correctly.
The native host parsing expects the `stacktrace` value to be set,
otherwise it discards the entire exception.
@dcalhoun dcalhoun added the [Type] Task Issues or PRs that have been broken down into an individual action to take label Dec 6, 2025
@dcalhoun dcalhoun marked this pull request as ready for review December 6, 2025 20:37
setUpGlobalErrorHandlers();
setBodyClasses();
await awaitGBKitGlobal();
setLogLevelFromGBKit();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hoisted from src/utils/editor.jsx to ensure messages from editor initialization log.

Comment on lines +122 to +125
logException( err, {
isHandled: true,
handledBy: 'loadPluginsIfEnabled',
} );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve observability of plugin loading failures.

Comment on lines +154 to +157
logException( err, {
isHandled: true,
handledBy: 'setUpEditorEnvironment',
} );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve observability of editor initialization failures.

if ( stacktrace.length ) {
exception.stacktrace = stacktrace;
}
exception.stacktrace = parseStacktrace( originalException );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always set the stacktrace to avoid native hosts discarding logged exceptions—e.g., ios/Sources/GutenbergKit/Sources/EditorViewControllerDelegate.swift.

E.g., if fetchEditorAssets throws due to an error from the native host, the error object will have an empty stack trace in the JavaScript runtime.

@dcalhoun dcalhoun requested a review from kean December 6, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants