mirror of
https://github.com/reactos/syzkaller.git
synced 2025-01-31 17:12:52 +00:00
dashboard/app: fix error wrapping
The current code does not do what it's supposed to do. Converting error to error is always true. Properly wrap errors.
This commit is contained in:
parent
2d1b3704eb
commit
b4680d8341
@ -64,8 +64,8 @@ func handleContext(fn contextHandler) http.Handler {
|
||||
}
|
||||
|
||||
type (
|
||||
ErrDontLog error
|
||||
ErrRedirect error
|
||||
ErrDontLog struct{ error }
|
||||
ErrRedirect struct{ error }
|
||||
)
|
||||
|
||||
func handleAuth(fn contextHandler) contextHandler {
|
||||
@ -188,7 +188,7 @@ func commonHeader(c context.Context, r *http.Request, w http.ResponseWriter, ns
|
||||
ns = adminPage
|
||||
}
|
||||
if ns != adminPage || !isAdminPage {
|
||||
return nil, ErrRedirect(fmt.Errorf("/%v", ns))
|
||||
return nil, ErrRedirect{fmt.Errorf("/%v", ns)}
|
||||
}
|
||||
}
|
||||
if ns != adminPage {
|
||||
|
@ -321,7 +321,7 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return ErrDontLog(fmt.Errorf("mandatory parameter id/extid is missing"))
|
||||
return ErrDontLog{fmt.Errorf("mandatory parameter id/extid is missing")}
|
||||
}
|
||||
accessLevel := accessLevel(c, r)
|
||||
if err := checkAccessLevel(c, r, bug.sanitizeAccess(accessLevel)); err != nil {
|
||||
@ -426,14 +426,14 @@ func handleTextImpl(c context.Context, w http.ResponseWriter, r *http.Request, t
|
||||
if x := r.FormValue("x"); x != "" {
|
||||
xid, err := strconv.ParseUint(x, 16, 64)
|
||||
if err != nil || xid == 0 {
|
||||
return ErrDontLog(fmt.Errorf("failed to parse text id: %v", err))
|
||||
return ErrDontLog{fmt.Errorf("failed to parse text id: %v", err)}
|
||||
}
|
||||
id = int64(xid)
|
||||
} else {
|
||||
// Old link support, don't remove.
|
||||
xid, err := strconv.ParseInt(r.FormValue("id"), 10, 64)
|
||||
if err != nil || xid == 0 {
|
||||
return ErrDontLog(fmt.Errorf("failed to parse text id: %v", err))
|
||||
return ErrDontLog{fmt.Errorf("failed to parse text id: %v", err)}
|
||||
}
|
||||
id = xid
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user