Documentation ¶
Index ¶
- func EnsureTrailingSlash(URL string) string
- func IsBadRequestError(err error) bool
- func IsCannotCompleteError(err error) bool
- func IsDeserializationError(err error) bool
- func IsNoMatchError(err error) bool
- func IsPermissionError(err error) bool
- func IsUnexpectedError(err error) bool
- func IsUnsupportedVersionError(err error) bool
- func JoinURLs(baseURL, path string) string
- func NewBadRequestError(message string) error
- func NewCannotCompleteError(message string) error
- func NewDeserializationError(format string, args ...interface{}) error
- func NewNoMatchError(message string) error
- func NewPermissionError(message string) error
- func NewUnexpectedError(err error) error
- func NewUnsupportedVersionError(format string, args ...interface{}) error
- func ParseJSON(t *testing.T, source string) interface{}
- func UpdateJSONMap(t *testing.T, source string, changes map[string]interface{}) string
- func WrapWithDeserializationError(err error, format string, args ...interface{}) error
- func WrapWithUnsupportedVersionError(err error) error
- type BadRequestError
- type CannotCompleteError
- type DeserializationError
- type NoMatchError
- type PermissionError
- type URLParams
- type UnexpectedError
- type UnsupportedVersionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureTrailingSlash ¶
EnsureTrailingSlash appends a slash at the end of the given string unless there already is one. This is used to create the kind of normalized URLs that Django expects. (to avoid Django's redirection when an URL does not ends with a slash.)
func IsBadRequestError ¶
IsBadRequestError returns true if err is a NoMatchError.
func IsCannotCompleteError ¶
IsCannotCompleteError returns true if err is a NoMatchError.
func IsDeserializationError ¶
IsDeserializationError returns true if err is a DeserializationError.
func IsNoMatchError ¶
IsNoMatchError returns true if err is a NoMatchError.
func IsPermissionError ¶
IsPermissionError returns true if err is a NoMatchError.
func IsUnexpectedError ¶
IsUnexpectedError returns true if err is an UnexpectedError.
func IsUnsupportedVersionError ¶
IsUnsupportedVersionError returns true if err is an UnsupportedVersionError.
func JoinURLs ¶
JoinURLs joins a base URL and a subpath together. Regardless of whether baseURL ends in a trailing slash (or even multiple trailing slashes), or whether there are any leading slashes at the begining of Path, the two will always be joined together by a single slash.
func NewBadRequestError ¶
NewBadRequestError constructs a new BadRequestError and sets the location.
func NewCannotCompleteError ¶
NewCannotCompleteError constructs a new CannotCompleteError and sets the location.
func NewDeserializationError ¶
NewDeserializationError constructs a new DeserializationError and sets the location.
func NewNoMatchError ¶
NewNoMatchError constructs a new NoMatchError and sets the location.
func NewPermissionError ¶
NewPermissionError constructs a new PermissionError and sets the location.
func NewUnexpectedError ¶
NewUnexpectedError constructs a new UnexpectedError and sets the location.
func NewUnsupportedVersionError ¶
NewUnsupportedVersionError constructs a new UnsupportedVersionError and sets the location.
func UpdateJSONMap ¶
UpdateJSONMap updates a json with changes
func WrapWithDeserializationError ¶
WrapWithDeserializationError constructs a new DeserializationError with the specified message, and sets the location and returns a new error with the full error stack set including the error passed in.
func WrapWithUnsupportedVersionError ¶
WrapWithUnsupportedVersionError constructs a new UnsupportedVersionError wrapping the passed error.
Types ¶
type BadRequestError ¶
BadRequestError is returned when the requested action cannot be performed due to bad or incorrect parameters passed to the server.
type CannotCompleteError ¶
CannotCompleteError is returned when the requested action is unable to complete for some server side reason.
type DeserializationError ¶
DeserializationError types are returned when the returned JSON data from the ControllerInterface doesn't match the code's expectations.
type NoMatchError ¶
NoMatchError is returned when the requested action cannot be performed due to being unable to service due to no entities available that match the request.
type PermissionError ¶
PermissionError is returned when the user does not have permission to do the requested action.
type URLParams ¶
URLParams wraps url.Values to easily add Values, but skipping empty ones.
func (*URLParams) MaybeAddBool ¶
MaybeAddBool adds the (Name, value) pair iff value is true.
func (*URLParams) MaybeAddInt ¶
MaybeAddInt adds the (Name, value) pair iff value is not zero.
func (*URLParams) MaybeAddMany ¶
MaybeAddMany adds the (Name, value) for each value in Values iff value is not empty.
type UnexpectedError ¶
UnexpectedError is an error for a condition that hasn't been determined.
type UnsupportedVersionError ¶
UnsupportedVersionError refers to calls made to an unsupported api version.