diff --git a/backend/api/handlers.go b/backend/api/handlers.go index 653a650..bfff4ac 100644 --- a/backend/api/handlers.go +++ b/backend/api/handlers.go @@ -25,7 +25,7 @@ func userAuth(c *gin.Context) { } user, err := db.UserAuth(context.Background(), credentials.Login, credentials.Password) if err != nil { - status, message := HandlePgError(err) + status, message := HandleDBError(err) c.JSON(status, gin.H{"error": message}) return } @@ -81,7 +81,7 @@ func quotesGet(c *gin.Context) { } quotes, err := db.QuotesGet(c, user_id, filter, sort, int(limit), int(offset)) if err != nil { - status, message := HandlePgError(err) + status, message := HandleDBError(err) c.JSON(status, gin.H{"error": message}) return } diff --git a/backend/api/utils.go b/backend/api/utils.go index 2b1a3ea..0a7efb7 100644 --- a/backend/api/utils.go +++ b/backend/api/utils.go @@ -6,7 +6,7 @@ import ( "github.com/jackc/pgx/v5/pgconn" ) -func HandlePgError(err error) (int, string) { +func HandleDBError(err error) (int, string) { pgErr, ok := err.(*pgconn.PgError) if !ok { return 500, err.Error()