Skip to content

Commit 682716e

Browse files
committed
feat: Enhance error logging in API and client, export TrpcClient type, and increment package version.
1 parent 1cea0fc commit 682716e

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@creatorem/next-trpc",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/creatorem/next-trpc"

src/create-trpc-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const createTrpcAPI = <Ctx>({
9292

9393
return NextResponse.json({ data: result }, { status: 200 });
9494
} catch (error) {
95+
console.error( error )
9596
if (error instanceof Error && "issues" in error) {
9697
// Zod validation error
9798
return NextResponse.json(

src/create-trpc-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type EndpointClient<Input, Output> = Input extends undefined
1111
key: string
1212
};
1313

14-
type TrpcClient<R extends Router<any>> = {
14+
export type TrpcClient<R extends Router<any>> = {
1515
[K in keyof R]: R[K] extends Endpoint<infer Output, infer Input, any>
1616
? EndpointClient<Input, Output>
1717
: never;
@@ -61,6 +61,7 @@ export const getTrpcFetch =
6161

6262
if (!response.ok) {
6363
const errorData = await response.json();
64+
console.error( errorData )
6465
throw new Error(errorData.error || "Request failed");
6566
}
6667

0 commit comments

Comments
 (0)