Skip to content

Commit

Permalink
Parse JavaScript exception before sending it to the Crash logging ser…
Browse files Browse the repository at this point in the history
…vice
  • Loading branch information
fluiddot committed Feb 27, 2024
1 parent 1b900e2 commit 9ea8dbd
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Aztec
import WordPressFlux
import Kanvas
import React
import AutomatticTracks

class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelegate, PublishingEditor {
let errorDomain: String = "GutenbergViewController.errorDomain"
Expand Down Expand Up @@ -1353,9 +1354,24 @@ extension GutenbergViewController: PostEditorNavigationBarManagerDelegate {
}
}

func gutenbergDidRequestLogException(_ exception: [AnyHashable: Any], with callback: @escaping () -> Void) {
func gutenbergDidRequestLogException(_ exception: GutenbergJSException, with callback: @escaping () -> Void) {
let jsException = JSException(
type: exception.type,
value: exception.value,
stacktrace: exception.stacktrace.map { JSException.StacktraceLine(
filename: $0.filename,
function: $0.function,
lineno: $0.lineno,
colno: $0.colno
) },
context: exception.context,
tags: exception.tags,
isHandled: exception.isHandled,
handledBy: exception.handledBy
)

DispatchQueue.main.async {
WordPressAppDelegate.crashLogging?.logJavaScriptException(exception, callback: callback)
WordPressAppDelegate.crashLogging?.logJavaScriptException(jsException, callback: callback)
}
}

Expand Down

0 comments on commit 9ea8dbd

Please sign in to comment.