Skip to content

Commit e4bcc68

Browse files
committed
fix: error message
1 parent 18144e3 commit e4bcc68

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

frontend/src/components/chat/Chat.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ const Chat = ({ setPage }) => {
137137
);
138138

139139
if (!response.ok) {
140-
throw new Error(`HTTP error! status: ${response.status}`);
140+
throw new Error(
141+
errorResponse.message || `HTTP error! status: ${response.status}`
142+
);
141143
}
142144

143145
const data = await response.json();
@@ -151,8 +153,8 @@ const Chat = ({ setPage }) => {
151153
},
152154
]);
153155
} catch (error) {
154-
console.error("Error sending message:", error);
155-
toast.error(`${error}`);
156+
console.error("Error sending message:", error.message);
157+
toast.error(error.message);
156158
} finally {
157159
setIsLoading(false);
158160
}

0 commit comments

Comments
 (0)