Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit 1c1af3b

Browse files
committed
fix(feedback): Error codes missmatch
1 parent 6e4a0e0 commit 1c1af3b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/plugins/feedback/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@better-auth-kit/feedback",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Feedback plugin for Better Auth Kit",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/plugins/feedback/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ export const feedback = (options?: FeedbackOptions) => {
9090
if (text.length < opts.minLength) {
9191
throw ctx.error("BAD_REQUEST", {
9292
message: ERROR_CODES.FEEDBACK_TOO_SHORT,
93+
code: "FEEDBACK_TOO_SHORT",
9394
});
9495
}
9596
if (text.length > opts.maxLength) {
9697
throw ctx.error("BAD_REQUEST", {
9798
message: ERROR_CODES.FEEDBACK_TOO_LONG,
99+
code: "FEEDBACK_TOO_LONG",
98100
});
99101
}
100102

@@ -106,6 +108,7 @@ export const feedback = (options?: FeedbackOptions) => {
106108
if (!ctx.context.session?.user) {
107109
throw ctx.error("BAD_REQUEST", {
108110
message: ERROR_CODES.USER_NOT_LOGGED_IN,
111+
code: "USER_NOT_LOGGED_IN",
109112
});
110113
}
111114

@@ -120,6 +123,7 @@ export const feedback = (options?: FeedbackOptions) => {
120123
if (!isAllowed) {
121124
throw ctx.error("FORBIDDEN", {
122125
message: ERROR_CODES.USER_NOT_ALLOWED,
126+
code: "USER_NOT_ALLOWED",
123127
});
124128
}
125129
}
@@ -136,6 +140,7 @@ export const feedback = (options?: FeedbackOptions) => {
136140
if (feedbackCount >= opts.feedbackLimit) {
137141
throw ctx.error("FORBIDDEN", {
138142
message: ERROR_CODES.FEEDBACK_LIMIT_REACHED,
143+
code: "FEEDBACK_LIMIT_REACHED",
139144
});
140145
}
141146
}

0 commit comments

Comments
 (0)