Skip to content

Commit

Permalink
fix: catch error when logging args (#2319)
Browse files Browse the repository at this point in the history
Ref: #2317

I think this should fix it.
  • Loading branch information
Lightning00Blade authored Jun 14, 2024
1 parent 9f5a0d8 commit 90b9708
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/bidiMapper/modules/log/LogManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,30 @@ export class LogManager {
);
for (const browsingContext of realm.associatedBrowsingContexts) {
this.#eventManager.registerPromiseEvent(
argsPromise.then((args) => ({
kind: 'success',
value: {
type: 'event',
method: ChromiumBidi.Log.EventNames.LogEntryAdded,
params: {
level: getLogLevel(params.type),
source: realm.source,
text: getRemoteValuesText(args, true),
timestamp: Math.round(params.timestamp),
stackTrace: getBidiStackTrace(params.stackTrace),
type: 'console',
// Console method is `warn`, not `warning`.
method: params.type === 'warning' ? 'warn' : params.type,
args,
argsPromise.then(
(args) => ({
kind: 'success',
value: {
type: 'event',
method: ChromiumBidi.Log.EventNames.LogEntryAdded,
params: {
level: getLogLevel(params.type),
source: realm.source,
text: getRemoteValuesText(args, true),
timestamp: Math.round(params.timestamp),
stackTrace: getBidiStackTrace(params.stackTrace),
type: 'console',
// Console method is `warn`, not `warning`.
method: params.type === 'warning' ? 'warn' : params.type,
args,
},
},
},
})),
}),
(error) => ({
kind: 'error',
error,
})
),
browsingContext.id,
ChromiumBidi.Log.EventNames.LogEntryAdded
);
Expand Down

0 comments on commit 90b9708

Please sign in to comment.