Documentation ¶
Index ¶
Constants ¶
View Source
const ( CodeAccessDenied = "system.accessDenied" CodeInternalError = "system.internalError" CodeInvalidParams = "system.invalidParams" CodeInvalidQuery = "system.invalidQuery" CodeMethodNotFound = "system.methodNotFound" CodeNoSubscription = "system.noSubscription" CodeNotFound = "system.notFound" CodeTimeout = "system.timeout" CodeInvalidRequest = "system.invalidRequest" CodeUnsupportedProtocol = "system.unsupportedProtocol" CodeSubjectTooLong = "system.subjectTooLong" CodeDeleted = "system.deleted" // HTTP only error codes CodeBadRequest = "system.badRequest" CodeMethodNotAllowed = "system.methodNotAllowed" CodeForbidden = "system.forbidden" )
Pre-defined RES error codes
Variables ¶
View Source
var ( ErrAccessDenied = &Error{Code: CodeAccessDenied, Message: "Access denied"} ErrDisposing = &Error{Code: CodeInternalError, Message: "Internal error: disposing connection"} ErrInternalError = &Error{Code: CodeInternalError, Message: "Internal error"} ErrInvalidParams = &Error{Code: CodeInvalidParams, Message: "Invalid parameters"} ErrInvalidQuery = &Error{Code: CodeInvalidQuery, Message: "Invalid query"} ErrMethodNotFound = &Error{Code: CodeMethodNotFound, Message: "Method not found"} ErrNoSubscription = &Error{Code: CodeNoSubscription, Message: "No subscription"} ErrNotFound = &Error{Code: CodeNotFound, Message: "Not found"} ErrTimeout = &Error{Code: CodeTimeout, Message: "Request timeout"} ErrInvalidRequest = &Error{Code: CodeInvalidRequest, Message: "Invalid request"} ErrUnsupportedProtocol = &Error{Code: CodeUnsupportedProtocol, Message: "Unsupported protocol"} ErrSubjectTooLong = &Error{Code: CodeSubjectTooLong, Message: "Subject too long"} ErrDeleted = &Error{Code: CodeDeleted, Message: "Deleted"} // HTTP only errors ErrBadRequest = &Error{Code: CodeBadRequest, Message: "Bad request"} ErrMethodNotAllowed = &Error{Code: CodeMethodNotAllowed, Message: "Method not allowed"} ErrForbiddenOrigin = &Error{Code: CodeForbidden, Message: "Forbidden origin"} )
Pre-defined RES errors https://github.com/resgateio/resgate/blob/master/docs/res-service-protocol.md#pre-defined-errors https://github.com/resgateio/resgate/blob/master/docs/res-client-protocol.md#pre-defined-errors
Functions ¶
Types ¶
type Error ¶
type Error struct { Code string `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
Error represents a RES error
func InternalError ¶
InternalError converts an error to an *Error with the code system.internalError.
Click to show internal directories.
Click to hide internal directories.