forked from mtusi2026/mtusi2026lab2
refactor(httpx): drop duplicate WriteError, add WriteInternal
This commit is contained in:
@@ -71,13 +71,7 @@ func (h *ChatHandler) Create(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
return
|
||||
case err != nil:
|
||||
httpx.WriteError(
|
||||
w,
|
||||
http.StatusInternalServerError,
|
||||
dto.ErrorCodeInternalError,
|
||||
"internal server error",
|
||||
requestID,
|
||||
)
|
||||
httpx.WriteInternal(w, requestID)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -112,13 +106,7 @@ func (h *ChatHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
return
|
||||
case err != nil:
|
||||
httpx.WriteError(
|
||||
w,
|
||||
http.StatusInternalServerError,
|
||||
dto.ErrorCodeInternalError,
|
||||
"internal server error",
|
||||
requestID,
|
||||
)
|
||||
httpx.WriteInternal(w, requestID)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -146,13 +134,7 @@ func (h *ChatHandler) List(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
return
|
||||
case err != nil:
|
||||
httpx.WriteError(
|
||||
w,
|
||||
http.StatusInternalServerError,
|
||||
dto.ErrorCodeInternalError,
|
||||
"internal server error",
|
||||
requestID,
|
||||
)
|
||||
httpx.WriteInternal(w, requestID)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user