代码拉取完成,页面将自动刷新
// Copyright 2024 FishGoddess. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package errors
const (
codeBadRequest = 400
codeForbidden = 403
codeNotFound = 404
codeRequireLogin = 1000
)
// BadRequest returns *Error with bad request code.
func BadRequest(message string, args ...any) *Error {
return Wrap(codeBadRequest, message, args...)
}
// Forbidden returns *Error with forbidden code.
func Forbidden(message string, args ...any) *Error {
return Wrap(codeForbidden, message, args...)
}
// NotFound returns *Error with not found code.
func NotFound(message string, args ...any) *Error {
return Wrap(codeNotFound, message, args...)
}
// RequireLogin returns *Error with require login code.
func RequireLogin(message string, args ...any) *Error {
return Wrap(codeRequireLogin, message, args...)
}
// MatchBadRequest matches err with bad request code.
func MatchBadRequest(err error) bool {
return Match(err, codeBadRequest)
}
// MatchForbidden matches err with forbidden code.
func MatchForbidden(err error) bool {
return Match(err, codeForbidden)
}
// MatchNotFound matches err with not found code.
func MatchNotFound(err error) bool {
return Match(err, codeNotFound)
}
// MatchRequireLogin matches err with require login code.
func MatchRequireLogin(err error) bool {
return Match(err, codeRequireLogin)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。