19 lines
360 B
Go
19 lines
360 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
photoserrors "gitlab.celogeek.com/photos/api/internal/photos/errors"
|
|
)
|
|
|
|
func (s *Service) Recovery(c *gin.Context) {
|
|
defer func() {
|
|
if err := recover(); err != nil {
|
|
s.LogErr.Print("PANIC", err)
|
|
s.Error(c, http.StatusInternalServerError, photoserrors.ErrUnexpected)
|
|
}
|
|
}()
|
|
c.Next()
|
|
}
|