You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
347 B
20 lines
347 B
package router
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func HttpErrorHandler(err error, c echo.Context) {
|
|
report, _ := err.(*echo.HTTPError)
|
|
|
|
response := &ResError{
|
|
Status: false,
|
|
Code: report.Code,
|
|
Error: fmt.Sprintf("%v", report.Message),
|
|
}
|
|
|
|
logError(c, response.Code, response.Error)
|
|
c.JSON(response.Code, response)
|
|
}
|