mirror of
https://github.com/1f349/orchid.git
synced 2024-12-22 08:04:10 +00:00
Improve error message output for checkAuthForCertificate
This commit is contained in:
parent
04551ec3bb
commit
2989a1e749
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/MrMelon54/mjwt/auth"
|
"github.com/MrMelon54/mjwt/auth"
|
||||||
vUtils "github.com/MrMelon54/violet/utils"
|
vUtils "github.com/MrMelon54/violet/utils"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -57,7 +58,12 @@ func checkAuthForCertificate(verify mjwt.Verifier, perm string, db *sql.DB, cb C
|
|||||||
// lookup certificate owner
|
// lookup certificate owner
|
||||||
id, err := checkCertOwner(db, params.ByName("id"), b)
|
id, err := checkCertOwner(db, params.ByName("id"), b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err.Error() == "not the certificate owner" {
|
||||||
|
apiError(rw, http.StatusBadRequest, "Not the certificate owner")
|
||||||
|
return
|
||||||
|
}
|
||||||
apiError(rw, http.StatusInsufficientStorage, "Database error")
|
apiError(rw, http.StatusInsufficientStorage, "Database error")
|
||||||
|
log.Println("[API] Failed to find certificate owner: ", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user