BREAKING: update mautrix to 0.15.x
This commit is contained in:
18
vendor/maunium.net/go/mautrix/error.go
generated
vendored
18
vendor/maunium.net/go/mautrix/error.go
generated
vendored
@@ -11,6 +11,8 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
// Common error codes from https://matrix.org/docs/spec/client_server/latest#api-standards
|
||||
@@ -60,6 +62,11 @@ var (
|
||||
MIncompatibleRoomVersion = RespError{ErrCode: "M_INCOMPATIBLE_ROOM_VERSION"}
|
||||
// The client specified a parameter that has the wrong value.
|
||||
MInvalidParam = RespError{ErrCode: "M_INVALID_PARAM"}
|
||||
|
||||
MURLNotSet = RespError{ErrCode: "M_URL_NOT_SET"}
|
||||
MBadStatus = RespError{ErrCode: "M_BAD_STATUS"}
|
||||
MConnectionTimeout = RespError{ErrCode: "M_CONNECTION_TIMEOUT"}
|
||||
MConnectionFailed = RespError{ErrCode: "M_CONNECTION_FAILED"}
|
||||
)
|
||||
|
||||
// HTTPError An HTTP Error response, which may wrap an underlying native Go Error.
|
||||
@@ -124,12 +131,13 @@ func (e *RespError) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
func (e *RespError) MarshalJSON() ([]byte, error) {
|
||||
if e.ExtraData == nil {
|
||||
e.ExtraData = make(map[string]interface{})
|
||||
data := maps.Clone(e.ExtraData)
|
||||
if data == nil {
|
||||
data = make(map[string]any)
|
||||
}
|
||||
e.ExtraData["errcode"] = e.ErrCode
|
||||
e.ExtraData["error"] = e.Err
|
||||
return json.Marshal(&e.ExtraData)
|
||||
data["errcode"] = e.ErrCode
|
||||
data["error"] = e.Err
|
||||
return json.Marshal(data)
|
||||
}
|
||||
|
||||
// Error returns the errcode and error message.
|
||||
|
||||
Reference in New Issue
Block a user