We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bf8a329 commit 8eb9969Copy full SHA for 8eb9969
src/error.ts
@@ -23,7 +23,11 @@ export class H3Error extends Error {
23
* @param input {Partial<H3Error>}
24
* @return {H3Error} An instance of the H3Error
25
*/
26
-export function createError (input: Partial<H3Error>): H3Error {
+export function createError (input: string | Partial<H3Error>): H3Error {
27
+ if (typeof input === 'string') {
28
+ return new H3Error(input)
29
+ }
30
+
31
if (input instanceof H3Error) {
32
return input
33
}
0 commit comments