{"modulePath":"github.com/Optum/dce","version":"v1.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Functions\n\n```go\nfunc As(err error, target interface{}) bool\n```\nAs gets the first error in the chain that matches the target\n\n```go\nfunc Cause(err error) error\n```\nCause gets the original error\n\n```go\nfunc GetStackTraceForError(err error) errors.StackTrace\n```\nGetStackTraceForError returns the HTTP status for a particular error.\n\n```go\nfunc HTTPCodeForError(err error) int\n```\nHTTPCodeForError returns the HTTP status for a particular error.\n\n```go\nfunc Is(err, target error) bool\n```\nIs for seeing if an error includes the target error\n\n```go\nfunc Unwrap(err error) error\n```\nUnwrap returns the result of calling the Unwrap method on err, if err's type contains an Unwrap method returning error. Otherwise, Unwrap returns nil.\n\n## Types\n\n```go\ntype GetStackTrace interface {\n\tStackTrace() errors.StackTrace\n}\n```\nGetStackTrace returns the API Code\n\n```go\ntype HTTPCode interface {\n\tHTTPCode() int\n}\n```\nHTTPCode returns the API Code\n\n```go\ntype MultiError struct {\n\tMessage string\n\tErrors  []error\n}\n```\nMultiError is an Error type that wraps multiple errors. This can be a useful way to combine errors in a method where you want to allow process to continue through multiple failed steps.\n\n```go\nfunc NewMultiError(msg string, errs []error) *MultiError\n```\nNewMultiError is a list of errors\n\n```go\nfunc (e MultiError) Error() string\n```\nError returns the error message to satisfy the error interface\n\n```go\nfunc (e MultiError) Is(err error) bool\n```\nIs to satisfy the error comparison interface\n\n```go\ntype StatusError struct {\n\tDetails detailError `json:\"error\"`\n\t// contains filtered or unexported fields\n}\n```\nStatusError is the custom error type we are using. Should satisfy errors interface\n\n```go\nfunc NewAdminRoleNotAssumable(role string, err error) *StatusError\n```\nNewAdminRoleNotAssumable returns a new error representing an admin role not being assumable\n\n```go\nfunc NewAlreadyExists(group string, name string) *StatusError\n```\nNewAlreadyExists returns a new error representing an already exists error\n\n```go\nfunc NewBadRequest(m string) *StatusError\n```\nNewBadRequest returns a new error representing a bad request\n\n```go\nfunc NewConflict(group string, name string, err error) *StatusError\n```\nNewConflict returns a new error for representing Conflicts\n\n```go\nfunc NewGenericStatusError(statusCode int, err error) *StatusError\n```\nNewGenericStatusError creates an error from a generic set of information\n\n```go\nfunc NewInternalServer(m string, err error) *StatusError\n```\nNewInternalServer returns an error for Internal Server Errors\n\n```go\nfunc NewNotFound(group string, name string) *StatusError\n```\nNewNotFound returns an a NotFound error with standard messaging\n\n```go\nfunc NewServiceUnavailable(m string) *StatusError\n```\nNewServiceUnavailable returns a new error representing service unavailable\n\n```go\nfunc NewUnathorizedError(m string) *StatusError\n```\nNewUnathorizedError returns an a NewUnathorizedError error with standard messaging\n\n```go\nfunc NewValidation(group string, err error) *StatusError\n```\nNewValidation creates a validation error\n\n```go\nfunc (e StatusError) Error() string\n```\n\n```go\nfunc (e StatusError) Format(s fmt.State, verb rune)\n```\nFormat for the standard format library\n\n```go\nfunc (e StatusError) HTTPCode() int\n```\nHTTPCode returns the http code\n\n```go\nfunc (e StatusError) Is(err error) bool\n```\nIs checks to see if the errors match\n\n```go\nfunc (e StatusError) OriginalError() error\n```\nOriginalError provides the underlying error\n\n```go\nfunc (e StatusError) StackTrace() errors.StackTrace\n```\nStackTrace returns the frames for a stack trace\n\n","path":"github.com/Optum/dce/pkg/errors","name":"errors","synopsis":"","isRedistributable":true}
