// Copyright 2019 Drone.IO Inc. All rights reserved. // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. package errors var ( // ErrInvalidToken is returned when the api request token is invalid. ErrInvalidToken = New("Invalid or missing token") // ErrUnauthorized is returned when the user is not authorized. ErrUnauthorized = New("Unauthorized") // ErrForbidden is returned when user access is forbidden. ErrForbidden = New("Forbidden") // ErrNotFound is returned when a resource is not found. ErrNotFound = New("Not Found") ) // Error represents a json-encoded API error. type Error struct { Message string `json:"message"` } func (e *Error) Error() string { return e.Message } // New returns a new error message. func New(text string) error { return &Error{Message: text} }