Skip to content

Commit ad2fd2b

Browse files
committed
feat: enhance error output
1 parent eff476d commit ad2fd2b

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

packages/core/src/registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ class Registry<C extends Context = Context> {
233233
if (index === -1) throw error
234234

235235
lines.splice(index - 1, Infinity)
236-
// lines.push(' at <cordis>')
237-
lines.push(...outerLines.slice(3))
236+
// lines.push(' at Registry.plugin (<anonymous>)')
237+
lines.push(...outerLines.slice(2))
238238
error.stack = lines.join('\n')
239239
throw error
240240
}

packages/hmr/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Watcher extends Service {
124124
}
125125

126126
async stop() {
127-
return await this.watcher.close()
127+
await this.watcher.close()
128128
}
129129

130130
async getLinked(filename: string) {

packages/loader/src/config/entry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export class Entry<C extends Context = Context> {
155155
try {
156156
exports = await this.parent.tree.import(this.options.name)
157157
} catch (error) {
158-
this.context.emit(this.ctx, 'internal/error', new Error(`Cannot find package "${this.options.name}"`))
159158
this.context.emit(this.ctx, 'internal/error', error)
160159
return
161160
}

packages/logger/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Context, Service } from '@cordisjs/core'
2-
import { defineProperty } from 'cosmokit'
2+
import { defineProperty, hyphenate } from 'cosmokit'
33
import Logger from 'reggol'
44

55
export { Logger }
@@ -46,7 +46,7 @@ export class LoggerService extends Service {
4646
static {
4747
for (const type of ['success', 'error', 'info', 'warn', 'debug', 'extend']) {
4848
LoggerService.prototype[type] = function (this: LoggerService, ...args: any[]) {
49-
return this(this.ctx.name)[type](...args)
49+
return this(hyphenate(this.ctx.name))[type](...args)
5050
}
5151
}
5252
}

0 commit comments

Comments
 (0)