1 Star 0 Fork 0

KingFane/mgate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
errors.go 745 Bytes
一键复制 编辑 原始数据 按行查看 历史
digitwin 提交于 2025-02-28 11:47 +08:00 . initial
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package http
import "encoding/json"
type httpProxyError struct {
statusCode int
err error
}
type HTTPProxyError interface {
error
MarshalJSON() ([]byte, error)
StatusCode() int
}
var _ HTTPProxyError = (*httpProxyError)(nil)
func (hpe *httpProxyError) Error() string {
return hpe.err.Error()
}
func (hpe *httpProxyError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Error string `json:"message"`
}{
Error: hpe.err.Error(),
})
}
func (hpe *httpProxyError) StatusCode() int {
return hpe.statusCode
}
func NewHTTPProxyError(statusCode int, err error) HTTPProxyError {
return &httpProxyError{statusCode: statusCode, err: err}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kingfane/mgate.git
git@gitee.com:kingfane/mgate.git
kingfane
mgate
mgate
v0.0.1

搜索帮助