diff options
author | Jordan <me@jordan.im> | 2022-09-30 11:52:44 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2022-09-30 11:52:44 -0700 |
commit | 0192a4e3f1c90df255e44831a579d9b0f611a543 (patch) | |
tree | 52c6bfa35b5491560af253a5e5ba90ed8a729871 /vendor/github.com/bwmarrin/discordgo/types.go | |
parent | 66bfe530b4fd5cb9755337ce718df26ee81f1b77 (diff) | |
download | keep-0192a4e3f1c90df255e44831a579d9b0f611a543.tar.gz keep-0192a4e3f1c90df255e44831a579d9b0f611a543.zip |
go.mod: bump discordgo, go-sqlite3, x/net
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/types.go')
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/types.go | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/types.go b/vendor/github.com/bwmarrin/discordgo/types.go deleted file mode 100644 index 7f969ae..0000000 --- a/vendor/github.com/bwmarrin/discordgo/types.go +++ /dev/null @@ -1,47 +0,0 @@ -// Discordgo - Discord bindings for Go -// Available at https://github.com/bwmarrin/discordgo - -// Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file contains custom types, currently only a timestamp wrapper. - -package discordgo - -import ( - "encoding/json" - "net/http" -) - -// RESTError stores error information about a request with a bad response code. -// Message is not always present, there are cases where api calls can fail -// without returning a json message. -type RESTError struct { - Request *http.Request - Response *http.Response - ResponseBody []byte - - Message *APIErrorMessage // Message may be nil. -} - -func newRestError(req *http.Request, resp *http.Response, body []byte) *RESTError { - restErr := &RESTError{ - Request: req, - Response: resp, - ResponseBody: body, - } - - // Attempt to decode the error and assume no message was provided if it fails - var msg *APIErrorMessage - err := json.Unmarshal(body, &msg) - if err == nil { - restErr.Message = msg - } - - return restErr -} - -func (r RESTError) Error() string { - return "HTTP " + r.Response.Status + ", " + string(r.ResponseBody) -} |