Skip to content

Commit d6aabd4

Browse files
committed
fix(cordis): fix perf regression for error.stack
1 parent bd17c03 commit d6aabd4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/reflect.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class ReflectService {
3939
if (!ctx.runtime.plugin) return
4040
// Case 4: custom inject checks
4141
if (ctx.bail(ctx, 'internal/inject', name)) return
42+
const lines = error.stack!.split('\n')
43+
lines.splice(1, 1)
44+
error.stack = lines.join('\n')
4245
ctx.emit(ctx, 'internal/warning', error)
4346
}
4447

@@ -53,9 +56,6 @@ class ReflectService {
5356
const [name, internal] = ReflectService.resolveInject(target, prop)
5457
// trace caller
5558
const error = new Error(`property ${name} is not registered, declare it as \`inject\` to suppress this warning`)
56-
const lines = error.stack!.split('\n')
57-
lines.splice(1, 1)
58-
error.stack = lines.join('\n')
5959
if (!internal) {
6060
ReflectService.checkInject(ctx, name, error)
6161
return Reflect.get(target, name, ctx)

0 commit comments

Comments
 (0)