Skip to content

Commit

Permalink
refactor: delete detail error on response internal server error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark committed Jun 25, 2024
1 parent 20ef961 commit 6102603
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/admin/handler/admin_handler_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (handler *adminHandlerImpl) AddAdminHandler(c echo.Context) error {

src, errOpen := file.Open()
if errOpen != nil {
return helper.ErrorHandler(c, http.StatusInternalServerError, "failed to open file: "+errOpen.Error())
return helper.ErrorHandler(c, http.StatusInternalServerError, "failed to open file")
}
defer src.Close()

Expand All @@ -64,7 +64,7 @@ func (handler *adminHandlerImpl) AddAdminHandler(c echo.Context) error {
if errors.Is(errUc, pkg.ErrUploadCloudinary) {
return helper.ErrorHandler(c, http.StatusInternalServerError, pkg.ErrUploadCloudinary.Error())
}
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error, detail : "+errUc.Error())
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error")
}

data := dto.AdminResponseRegister{
Expand Down Expand Up @@ -190,7 +190,7 @@ func (handler *adminHandlerImpl) UpdateAdminHandler(c echo.Context) error {
}
src, errOpen := reqFile.Open()
if errOpen != nil {
return helper.ErrorHandler(c, http.StatusInternalServerError, "failed to open file: "+errOpen.Error())
return helper.ErrorHandler(c, http.StatusInternalServerError, "failed to open file")
}
defer src.Close()

Expand All @@ -215,7 +215,7 @@ func (handler *adminHandlerImpl) UpdateAdminHandler(c echo.Context) error {
return helper.ErrorHandler(c, http.StatusBadRequest, pkg.ErrRole.Error())
}

return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error, detail : "+errUc.Error())
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error")
}

data := dto.AdminResponseUpdate{
Expand All @@ -236,7 +236,7 @@ func (handler *adminHandlerImpl) GetProfileAdminHandler(c echo.Context) error {
if errors.Is(err, pkg.ErrAdminNotFound) {
return helper.ErrorHandler(c, http.StatusNotFound, err.Error())
}
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error, detail : "+err.Error())
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error")
}

data := dto.AdminResponseGetDataById{
Expand All @@ -259,7 +259,7 @@ func (handler *adminHandlerImpl) DeleteAdminHandler(c echo.Context) error {
if errors.Is(err, pkg.ErrAdminNotFound) {
return helper.ErrorHandler(c, http.StatusNotFound, err.Error())
}
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error, detail : "+err.Error())
return helper.ErrorHandler(c, http.StatusInternalServerError, "internal server error")
}
responseData := helper.ResponseData(http.StatusOK, "data successfully deleted", nil)
return c.JSON(http.StatusOK, responseData)
Expand Down

0 comments on commit 6102603

Please sign in to comment.