{"modulePath":"github.com/smartcontractkit/chainlink-common","version":"v0.11.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Functions\n\n```go\nfunc PrePendPrivateVisibilityIdentifier(errorMessage string) string\n```\n\n## Types\n\n```go\ntype Error interface {\n\terror\n\n\tVisibility() Visibility\n\tOrigin() Origin\n\tCode() ErrorCode\n\tSerializeToString() string\n\tSerializeToRemoteString() string\n\tEquals(otherErr Error) bool\n}\n```\n\n```go\nfunc DeserializeErrorFromString(errorMsg string) Error\n```\n\n```go\nfunc NewError(err error, visibility Visibility, origin Origin, errorCode ErrorCode) Error\n```\n\n```go\nfunc NewPrivateSystemError(err error, errorCode ErrorCode) Error\n```\nNewPrivateSystemError indicates that the wrapped error is due to a system-level issue and may contain sensitive information that should only be visible to the node on which it occurred.  The error code will still be visible to other nodes in the network.\n\n```go\nfunc NewPrivateUserError(err error, errorCode ErrorCode) Error\n```\nNewPrivateUserError indicates that the wrapped error is due to a user-level issue and may contain sensitive information that should only be visible to the node on which it occurred.  The error code will still be visible to other nodes in the network.\n\n```go\nfunc NewPublicSystemError(err error, errorCode ErrorCode) Error\n```\nNewPublicSystemError indicates that the wrapped error is due to a system-level issue and does not contain any sensitive information that should only be visible to the node on which it occurred, making it safe to share the full error details with other nodes in the network.\n\n```go\nfunc NewPublicUserError(err error, errorCode ErrorCode) Error\n```\nNewPublicUserError indicates that the wrapped error is due to a user-level issue and does not contain any information that should only be visible to the node on which it occurred, making it safe to share the full error details with other nodes in the network.\n\n```go\ntype ErrorCode uint32\n```\n\n```go\nconst (\n\t// Canceled indicates the operation was canceled (typically by the caller).\n\tCanceled ErrorCode = 1\n\n\t// Unknown error. An example of where this error may be returned is\n\t// if a Status value received from another address space belongs to\n\t// an error-space that is not known in this address space. Also\n\t// errors raised by APIs that do not return enough error information\n\t// may be converted to this error.\n\tUnknown ErrorCode = 2\n\n\t// InvalidArgument indicates client specified an invalid argument.\n\t// Note that this differs from FailedPrecondition. It indicates arguments\n\t// that are problematic regardless of the state of the system\n\t// (e.g., a malformed file name).\n\tInvalidArgument ErrorCode = 3\n\n\t// DeadlineExceeded means operation expired before completion.\n\t// For operations that change the state of the system, this error may be\n\t// returned even if the operation has completed successfully. For\n\t// example, a successful response from a server could have been delayed\n\t// long enough for the deadline to expire.\n\tDeadlineExceeded ErrorCode = 4\n\n\t// NotFound means some requested entity (e.g., file or directory) was\n\t// not found.\n\tNotFound ErrorCode = 5\n\n\t// AlreadyExists means an attempt to create an entity failed because one\n\t// already exists.\n\tAlreadyExists ErrorCode = 6\n\n\t// PermissionDenied indicates the caller does not have permission to\n\t// execute the specified operation. It must not be used for rejections\n\t// caused by exhausting some resource (use ResourceExhausted\n\t// instead for those errors). It must not be\n\t// used if the caller cannot be identified (use Unauthenticated\n\t// instead for those errors).\n\tPermissionDenied ErrorCode = 7\n\n\t// ResourceExhausted indicates some resource has been exhausted, perhaps\n\t// a per-user quota, or perhaps the entire file system is out of space.\n\tResourceExhausted ErrorCode = 8\n\n\t// FailedPrecondition indicates operation was rejected because the\n\t// system is not in a state required for the operation's execution.\n\t// For example, directory to be deleted may be non-empty, an rmdir\n\t// operation is applied to a non-directory, etc.\n\t//\n\t// A litmus test that may help a service implementor in deciding\n\t// between FailedPrecondition, Aborted, and Unavailable:\n\t//  (a) Use Unavailable if the client can retry just the failing call.\n\t//  (b) Use Aborted if the client should retry at a higher-level\n\t//      (e.g., restarting a read-modify-write sequence).\n\t//  (c) Use FailedPrecondition if the client should not retry until\n\t//      the system state has been explicitly fixed. E.g., if an \"rmdir\"\n\t//      fails because the directory is non-empty, FailedPrecondition\n\t//      should be returned since the client should not retry unless\n\t//      they have first fixed up the directory by deleting files from it.\n\t//  (d) Use FailedPrecondition if the client performs conditional\n\t//      REST Get/Update/Delete on a resource and the resource on the\n\t//      server does not match the condition. E.g., conflicting\n\t//      read-modify-write on the same resource.\n\tFailedPrecondition ErrorCode = 9\n\n\t// Aborted indicates the operation was aborted, typically due to a\n\t// concurrency issue like sequencer check failures, transaction aborts,\n\t// etc.\n\t//\n\t// See litmus test above for deciding between FailedPrecondition,\n\t// Aborted, and Unavailable.\n\tAborted ErrorCode = 10\n\n\t// OutOfRange means operation was attempted past the valid range.\n\t// E.g., seeking or reading past end of file.\n\t//\n\t// Unlike InvalidArgument, this error indicates a problem that may\n\t// be fixed if the system state changes. For example, a 32-bit file\n\t// system will generate InvalidArgument if asked to read at an\n\t// offset that is not in the range [0,2^32-1], but it will generate\n\t// OutOfRange if asked to read from an offset past the current\n\t// file size.\n\t//\n\t// There is a fair bit of overlap between FailedPrecondition and\n\t// OutOfRange. We recommend using OutOfRange (the more specific\n\t// error) when it applies so that callers who are iterating through\n\t// a space can easily look for an OutOfRange error to detect when\n\t// they are done.\n\tOutOfRange ErrorCode = 11\n\n\t// Unimplemented indicates operation is not implemented or not\n\t// supported/enabled in this service.\n\tUnimplemented ErrorCode = 12\n\n\t// Internal errors. Means some invariants expected by underlying\n\t// system has been broken. If you see one of these errors,\n\t// something is very broken.\n\tInternal ErrorCode = 13\n\n\t// Unavailable indicates the service is currently unavailable.\n\t// This is a most likely a transient condition and may be corrected\n\t// by retrying with a backoff. Note that it is not always safe to retry\n\t// non-idempotent operations.\n\t//\n\t// See litmus test above for deciding between FailedPrecondition,\n\t// Aborted, and Unavailable.\n\tUnavailable ErrorCode = 14\n\n\t// DataLoss indicates unrecoverable data loss or corruption.\n\tDataLoss ErrorCode = 15\n\n\t// Unauthenticated indicates the request does not have valid\n\t// authentication credentials for the operation.\n\tUnauthenticated ErrorCode = 16\n\n\t// ConsensusFailed indicates failure to reach consensus\n\tConsensusFailed ErrorCode = 100\n)\n```\nCapability error codes are primarily based on gRPC error codes: [https://grpc.github.io/grpc/core/md\\_doc\\_statuscodes.html](https://grpc.github.io/grpc/core/md_doc_statuscodes.html) Custom error codes specific to this project should start from 100 to avoid conflicts with future gRPC codes. Note: 0 (OK) is intentionally excluded because capability errors must always indicate a failure condition.\n\n```go\nfunc FromErrorCodeString(str string) ErrorCode\n```\n\n```go\nfunc (e ErrorCode) String() string\n```\nString returns the string representation of the ErrorCode.\n\n```go\ntype Origin int\n```\n\n```go\nconst (\n\t// OriginSystem The error originated from a system issue.\n\tOriginSystem Origin = 0\n\n\t// OriginUser The error originated from user input or action.\n\tOriginUser Origin = 1\n)\n```\n\n```go\nfunc FromOriginString(s string) Origin\n```\nFromOriginString converts a string to an Origin value.\n\n```go\nfunc (o Origin) String() string\n```\n\n```go\ntype Visibility int\n```\n\n```go\nconst (\n\t// VisibilityPublic The full details of the error can be shared across all nodes in the network.\n\tVisibilityPublic Visibility = 0\n\n\t// VisibilityPrivate The error contains sensitive information that should only be visible to the local node.\n\tVisibilityPrivate Visibility = 1\n)\n```\n\n```go\nfunc FromVisibilityString(s string) Visibility\n```\nFromVisibilityString converts a string to a Visibility value.\n\n```go\nfunc (v Visibility) String() string\n```\nString returns the string representation of the Visibility value.\n\n","path":"github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors","name":"errors","synopsis":"","isRedistributable":true}
