mirror of
https://github.com/harness/drone.git
synced 2025-05-03 22:50:07 +08:00
fix: [CODE-3210]: Move error logs on translation layer to verbosity level info (#3451)
This commit is contained in:
parent
b5e78f3300
commit
8732b64aa8
@ -46,7 +46,7 @@ func Translate(ctx context.Context, err error) *Error {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// print original error for debugging purposes
|
// print original error for debugging purposes
|
||||||
log.Ctx(ctx).Debug().Err(err).Msgf("translating error to user facing error")
|
log.Ctx(ctx).Info().Err(err).Msgf("translating error to user facing error")
|
||||||
|
|
||||||
// TODO: Improve performance of checking multiple errors with errors.Is
|
// TODO: Improve performance of checking multiple errors with errors.Is
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ func Translate(ctx context.Context, err error) *Error {
|
|||||||
case errors.Is(err, codeowners.ErrNotFound):
|
case errors.Is(err, codeowners.ErrNotFound):
|
||||||
return ErrCodeOwnersNotFound
|
return ErrCodeOwnersNotFound
|
||||||
case errors.As(err, &codeOwnersTooLargeError):
|
case errors.As(err, &codeOwnersTooLargeError):
|
||||||
return UnprocessableEntityf(codeOwnersTooLargeError.Error())
|
return UnprocessableEntity(codeOwnersTooLargeError.Error())
|
||||||
case errors.As(err, &codeOwnersFileParseError):
|
case errors.As(err, &codeOwnersFileParseError):
|
||||||
return NewWithPayload(
|
return NewWithPayload(
|
||||||
http.StatusUnprocessableEntity,
|
http.StatusUnprocessableEntity,
|
||||||
|
@ -145,6 +145,11 @@ func RequestTooLargef(format string, args ...any) *Error {
|
|||||||
return Newf(http.StatusRequestEntityTooLarge, format, args...)
|
return Newf(http.StatusRequestEntityTooLarge, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnprocessableEntity returns a new user facing unprocessable entity error.
|
||||||
|
func UnprocessableEntity(message string) *Error {
|
||||||
|
return New(http.StatusUnprocessableEntity, message)
|
||||||
|
}
|
||||||
|
|
||||||
// UnprocessableEntityf returns a new user facing unprocessable entity error.
|
// UnprocessableEntityf returns a new user facing unprocessable entity error.
|
||||||
func UnprocessableEntityf(format string, args ...any) *Error {
|
func UnprocessableEntityf(format string, args ...any) *Error {
|
||||||
return Newf(http.StatusUnprocessableEntity, format, args...)
|
return Newf(http.StatusUnprocessableEntity, format, args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user