Fix handling of unwrapped error

This commit is contained in:
Neeraj Gupta
2025-05-08 11:19:57 +05:30
parent 0d660f239f
commit c3b1da2a7e

View File

@@ -37,6 +37,9 @@ func Error(c *gin.Context, err error) {
isClientError = true
}
unWrappedErr := errors.Unwrap(err)
if unWrappedErr == nil {
unWrappedErr = err
}
enteApiErr, isEnteApiErr := unWrappedErr.(*ente.ApiError)
if isEnteApiErr && enteApiErr.HttpStatusCode >= 400 && enteApiErr.HttpStatusCode < 500 {
isClientError = true