Documentation
¶
Index ¶
- Constants
- func Contains(code, id string, err error) bool
- func ContainsError(err error, msg string) bool
- func IsAnyPQError(err error) bool
- func IsCouldNotLockPQError(err error) bool
- func IsNoRowsPQError(err error) bool
- func IsPQError(err error, errorCode string) bool
- func N(code, msg string) (err error)
- func New(code, id, msg string) (err error)
- func NewStr(code, id string, msgList ...string) (s string)
- func WWM(err error, code, msg string, debugMessages ...string) error
- func WrapWithMsg(err error, code, id, msg string, debugMessages ...string) error
- type ExtendedError
Constants ¶
const ( // package: migration Code0001 = "0001" // package:migration | migration/migration.go Code0002 = "0002" // package:migration | migration/migration_list.go Code0003 = "0003" // package:migration/sqlmodel | migration/sqlmodel/migration.go // package: sql Code0201 = "0201" // package:sql | sql/count.go Code0202 = "0202" // package:sql | sql/row.go Code0203 = "0203" // package:sql | sql/sql.go Code0204 = "0204" // package:sql | sql/status.go Code0205 = "0205" // package:sql | sql/txn.go Code0206 = "0206" // package:sql | sql/rows.go Code0207 = "0207" // package:sql | sql/bulk.go Code0208 = "0208" // package:sql | sql/statement.go Code0209 = "0209" // package:sql | sql/bulk_update.go // package: process Code0301 = "0301" // package:process | process/process.go Code0302 = "0302" // package:sqlmodel | process/internal/sqlmodel/process.go Code0303 = "0303" // package:sqlmodel | process/internal/sqlmodel/process_run.go Code0304 = "0304" // package:process | process/queue.go //package: arc Code0401 = "0401" // package:arc | arc/arc_client.go Code0402 = "0402" // package:arc | arc/arcimedes_user.go Code0403 = "0403" // package:arc | arc/cart_customer.go Code0404 = "0404" // package:arc | arc/core_user.go Code0405 = "0405" // package:arc | arc/deployment_data.go Code0406 = "0406" // package:arc | arc/deployment_notify.go Code0407 = "0407" // package:arc | arc/deployment.go Code0408 = "0408" // package:arc | arc/grant_login.go Code0409 = "0409" // package:arc | arc/grant.go Code040A = "040A" // package:arc | arc/response.go Code040B = "040B" // package:arc/sqlmodel | arc/sqlmodel/credential.go Code040C = "040C" // package:arc/sqlmodel | arc/sqlmodel/data.go Code040D = "040D" // package:arc/sqlmodel | arc/sqlmodel/deployment.go // Code040E = "040E" // Code040F = "040F" // Code040G = "040G" // Code040H = "040H" // Code040I = "040I" // Code040J = "040J" // Code040K = "040K" // Code040L = "040L" // Code040M = "040M" // Code040N = "040N" // Code040O = "040O" // Code040P = "040P" // Code040Q = "040Q" // Code040R = "040R" // Code040S = "040S" // Code040T = "040T" // Code040U = "040U" // Code040V = "040V" // Code040W = "040W" // Code040X = "040X" // Code040Y = "040Y" Code040Z = "040Z" // package:arc/sqlmodel | arc/sqlmodel/deployment_grant.go //package: algolia Code0501 = "0501" Code0502 = "0502" Code0503 = "0503" //package: sync Code0601 = "0601" Code0602 = "0602" Code0603 = "0603" //package: pubsub Code0701 = "0701" // package pubsub | pubsub/publish.go Code0702 = "0702" // package pubsub | pubsub/subscriber.go Code0703 = "0703" // package pubsub | pubsub/subscriber_notify.go Code0704 = "0704" // package pubsub | pubsub/subscriber_process.go Code0705 = "0705" // package pubsub/sqlmodel | pubsub/internal/sub_data_bulk.go Code0706 = "0706" // package pubsub/sqlmodel | pubsub/internal/sqlmodel/pub.go Code0707 = "0707" // package pubsub/sqlmodel | pubsub/internal/sqlmodel/sub.go Code0708 = "0708" // package pubsub/sqlmodel | pubsub/internal/sqlmodel/data.go Code0709 = "0709" // package pubsub/sqlmodel | pubsub/internal/sqlmodel/sub_data.go Code070A = "070A" // package pubsub | pubsub/subscriber_batch.go Code070B = "070B" // package pubsub | pubsub/subscriber_batch_queue.go Code070C = "070C" // package pubsub | pubsub/publisher.go Code070D = "070D" // package pubsub | pubsub/publish_batch.go //package: kafka_aws_ec2 Code0800 = "0800" // package kafka | kafka/connection.go Code0801 = "0801" // package kafka_aws_ec2 | kafka/aws/ec2/sasl.go )
const ( MsgUnknownInternalServerError = "Unknown Internal Server Error" MsgUnauthenticated = "Authentication Failed" MsgForbidden = "Forbidden" // migrations MsgMigrationCodeVersionDNE = "Migration code/version does not exist" MsgMigrationNotInstalled = "Migrations library not installed" MsgMigrationNone = "No migrations exist yet" MsgMigrationFileNameInvalid = "Invalid migration file name" MsgMigrationFileNameVersionInvalid = "Invalid migration file name version" MsgMigrationInstallFailed = "Migrator installation failed" // arc MsgCartCustomerExists = "Cart customer already exist" MsgCartCustomerNotExists = "Cart customer does not exist" MsgGrantDoesNotExist = "Grant does not exist" MsgCredentialDoesNotExist = "Credential does not exist" MsgInvalidGrant = "invalid_grant" MsgArcimedesUserExists = "Arcimedes user already exists" MsgArcimedesUserNotExists = "Arcimedes user does not exist" MsgCoreUserExists = "Core user already exists" MsgCoreUserNotExists = "Core user does not exist" MsgDeploymentDoesNotExist = "Deployment does not exist" MsgDataDoesNotExist = "Data record does not exist" )
const ( // PQErr23505UniqueViolation Postgres code for unique violation PQErr23505UniqueViolation = "23505" // PQErr58030IOError Postgres code for i/o error ("could not write to temporary file") PQErr58030IOError = "58030" // PQErr42P01 pq: relation "<string>" does not exist PQErr42P01 = "42P01" )
Variables ¶
This section is empty.
Functions ¶
func ContainsError ¶
ContainsError checks if the error contains the specified error message
func IsAnyPQError ¶
IsAnyPQError checks if the passed error is a Postgres error
func IsCouldNotLockPQError ¶
IsCouldNotLockPQError whether the error is a pg sql could not obtain lock error
func IsNoRowsPQError ¶
IsNoRowsPQError returns whether the error is a pg sql no rows found
func New ¶
New creates a new error based on the code, id and message, it also sets the Message property of the extended error to the passed message
Types ¶
type ExtendedError ¶
type ExtendedError struct { InnerError error Message string TruncateXLines int // contains filtered or unexported fields }
ExtendedError is our custom error
func AsExtendedError ¶
func AsExtendedError(err error) (ee *ExtendedError)
AsExtendedError helper function that returns the error as an ExtendedError if it is one. Otherwise it returns nil
func W ¶
func W(err error, code string, debugMessages ...string) (ee *ExtendedError)
W shorter version of wrap that takes the entire code as one parameter See Wrap for full details
func Wrap ¶
func Wrap(err error, code, id string, debugMessages ...string) (ee *ExtendedError)
Wrap checks if the passed error has been wrapped before by this func and either wraps the original error as an ExtendedError or adds the debug message to the already existing ExtendedError's InnerError. It will also overwrite the current ExtendedError's user message if the passed userMsg is not empty i.e. is it an ExtendedError. If not, it will create an ExtendedError, assign the InnerError and UserMsg to it and then return it. If it already is an ExtendedError This function always returns an extended error, but the signature is error
func (*ExtendedError) AsError ¶
func (e *ExtendedError) AsError(tgt interface{}) bool
AsError calls errors.As on the original error with the specified target error. If it is the target error, it will set the target as the original error value and return true, otherwise it returns false
func (*ExtendedError) Error ¶
func (e *ExtendedError) Error() string
Error returns the string of the inner error
func (*ExtendedError) IsError ¶
func (e *ExtendedError) IsError(tgt error) bool
IsError checks if the originating error is the specified target