Skip to content

Commit dcc59f2

Browse files
committed
fix: add NitroSQLite prefix to custom error
1 parent 158565f commit dcc59f2

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

package/src/NitroSQLiteError.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const NITRO_SQLITE_ERROR_NAME = 'NitroSQLiteError'
1+
const NITRO_SQLITE_ERROR_NAME = 'NitroSQLiteError' as const
2+
const NITRO_SQLITE_ERROR_PREFIX = '[NitroSQLite] ' as const
23

34
/**
45
* Custom error class for NitroSQLite operations
@@ -8,6 +9,7 @@ export default class NitroSQLiteError extends Error {
89
constructor(message: string, options?: ErrorOptions) {
910
super(message, options)
1011
this.name = NITRO_SQLITE_ERROR_NAME
12+
this.message = NITRO_SQLITE_ERROR_PREFIX + message
1113

1214
// Maintains proper prototype chain for instanceof checks
1315
Object.setPrototypeOf(this, NitroSQLiteError.prototype)
@@ -41,12 +43,4 @@ export default class NitroSQLiteError extends Error {
4143
cause: error,
4244
})
4345
}
44-
45-
/**
46-
* Converts a native error (from C++ bridge) to a NitroSQLiteError
47-
* Alias for fromError for semantic clarity
48-
*/
49-
static fromNativeError(error: unknown): NitroSQLiteError {
50-
return NitroSQLiteError.fromError(error)
51-
}
5246
}

0 commit comments

Comments
 (0)