Skip to content

Commit

Permalink
chore: lint & typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Bekacru committed Jul 19, 2024
1 parent cdae87b commit cd8118f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
"lint:fix": "biome check . --apply",
"typecheck": "tsc --noEmit"
},
"files": [
"dist"
],
"files": ["dist"],
"type": "module"
}
9 changes: 8 additions & 1 deletion src/test/create.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { createApp, toNodeListener } from "h3";
import { type Listener, listen } from "listhen";
import { afterAll, beforeAll, describe, expect, expectTypeOf, it } from "vitest";
import {
afterAll,
beforeAll,
describe,
expect,
expectTypeOf,
it,
} from "vitest";
import { ZodError, z } from "zod";
import {
type FetchSchemaRoutes,
Expand Down
14 changes: 9 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,19 @@ export function getURL(url: string, options?: BetterFetchOption) {
url = url.replace(`@${m}/`, "/");
}
}
let _url;
let _url: string | URL;
try {
_url = url.startsWith("http") ? url : new URL(url, options?.baseURL);
} catch(e) {
if(e instanceof TypeError){
} catch (e) {
if (e instanceof TypeError) {
if (!options?.baseURL) {
throw TypeError(`Invalid URL ${url}. Are you passing in a relative url but not setting the baseURL?`)
throw TypeError(
`Invalid URL ${url}. Are you passing in a relative url but not setting the baseURL?`,
);
}
throw TypeError(`Invalid URL ${url}. Please validate that you are passing the correct input.`)
throw TypeError(
`Invalid URL ${url}. Please validate that you are passing the correct input.`,
);
}
throw e;
}
Expand Down

0 comments on commit cd8118f

Please sign in to comment.