Skip to content

Commit db49152

Browse files
committed
fix: put more error logs behind debug info setting
1 parent 0217768 commit db49152

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

packages/app-backend-api/src/hooks.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PluginPermission, hasPluginPermission } from '@vue-devtools/shared-utils'
1+
import { PluginPermission, SharedData, hasPluginPermission } from '@vue-devtools/shared-utils'
22
import type { HookHandler, HookPayloads, Hookable } from '@vue/devtools-api'
33
import { Hooks } from '@vue/devtools-api'
44
import type { BackendContext } from './backend-context'
@@ -59,8 +59,10 @@ export class DevtoolsHookable implements Hookable<BackendContext> {
5959
await handler(payload, ctx)
6060
}
6161
catch (e) {
62-
console.error(`An error occurred in hook '${eventType}'${plugin ? ` registered by plugin '${plugin.descriptor.id}'` : ''} with payload:`, payload)
63-
console.error(e)
62+
if (SharedData.debugInfo) {
63+
console.error(`An error occurred in hook '${eventType}'${plugin ? ` registered by plugin '${plugin.descriptor.id}'` : ''} with payload:`, payload)
64+
console.error(e)
65+
}
6466
}
6567
}
6668
}

packages/app-backend-core/src/app.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,10 @@ export function _legacy_getAndRegisterApps(ctx: BackendContext, clear = false) {
272272
})
273273
}
274274
catch (e) {
275-
console.error(`Error scanning for legacy apps:`)
276-
console.error(e)
275+
if (SharedData.debugInfo) {
276+
console.error(`Error scanning for legacy apps:`)
277+
console.error(e)
278+
}
277279
}
278280
}, 0)
279281
}

packages/app-backend-core/src/index.ts

+16-8
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,19 @@ async function connect() {
407407
await addPreviouslyRegisteredPlugins(ctx)
408408
}
409409
catch (e) {
410-
console.error(`Error adding previously registered plugins:`)
411-
console.error(e)
410+
if (SharedData.debugInfo) {
411+
console.error(`Error adding previously registered plugins:`)
412+
console.error(e)
413+
}
412414
}
413415
try {
414416
await addQueuedPlugins(ctx)
415417
}
416418
catch (e) {
417-
console.error(`Error adding queued plugins:`)
418-
console.error(e)
419+
if (SharedData.debugInfo) {
420+
console.error(`Error adding queued plugins:`)
421+
console.error(e)
422+
}
419423
}
420424

421425
hook.on(HookEvents.SETUP_DEVTOOLS_PLUGIN, async (pluginDescriptor: PluginDescriptor, setupFn: SetupFunction) => {
@@ -450,8 +454,10 @@ async function connect() {
450454
}, ctx)
451455
}
452456
catch (e) {
453-
console.error(`Error while adding devtools connected timeline marker:`)
454-
console.error(e)
457+
if (SharedData.debugInfo) {
458+
console.error(`Error while adding devtools connected timeline marker:`)
459+
console.error(e)
460+
}
455461
}
456462
}
457463

@@ -589,10 +595,12 @@ function connectBridge() {
589595
await action()
590596
}
591597
catch (e) {
592-
console.error(e)
598+
if (SharedData.debugInfo) {
599+
console.error(e)
600+
}
593601
}
594602
}
595-
else {
603+
else if (SharedData.debugInfo) {
596604
console.warn(`Couldn't revive action ${actionIndex} from`, value)
597605
}
598606
})

0 commit comments

Comments
 (0)