mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-02-22 08:31:30 +08:00
Use errors.Is everywhere
This commit is contained in:
parent
476e667572
commit
cd13fe3cff
@ -22,6 +22,7 @@ import (
|
||||
"crypto/rand"
|
||||
"database/sql"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/pagefaultgames/rogueserver/db"
|
||||
@ -43,7 +44,7 @@ func Login(username, password string) (LoginResponse, error) {
|
||||
|
||||
key, salt, err := db.FetchAccountKeySaltFromUsername(username)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return response, fmt.Errorf("account doesn't exist")
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ func legacyHandleSaveData(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/savedata/get":
|
||||
save, err = savedata.Get(uuid, datatype, slot)
|
||||
if err == sql.ErrNoRows {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user