feat: add ErrNoSuchMessage to pmapi

This commit is contained in:
James Houlahan
2020-04-16 17:32:30 +02:00
committed by Jakub Cuth
parent d1e63254f2
commit e1ecc11f38
5 changed files with 12 additions and 1 deletions

View File

@ -56,6 +56,8 @@ var (
ErrInvalidToken = errors.New("refresh token invalid")
ErrAPINotReachable = errors.New("cannot reach the server")
ErrUpgradeApplication = errors.New("application upgrade required")
ErrNoSuchMessage = errors.New("no such message")
)
type ErrUnauthorized struct {

View File

@ -532,7 +532,13 @@ func (c *Client) GetMessage(id string) (msg *Message, err error) {
return
}
if res.StatusCode == http.StatusUnprocessableEntity {
err = ErrNoSuchMessage
return
}
msg, err = res.Message, res.Err()
return
}

View File

@ -17,6 +17,8 @@
package pmapi
import "net/http"
// Common response codes.
const (
CodeOk = 1000