Documentation ¶
Index ¶
- func As(err error, target interface{}) bool
- func DisableLocationTracking()
- func EnableLocationTracking()
- func Is(err, target error) bool
- func Join(errs ...error) error
- func Unwrap(err error) error
- type CallSite
- func (v *CallSite) Copy() *CallSite
- func (v *CallSite) CopyAsInterface() interface{}
- func (v *CallSite) Equal(u *CallSite) bool
- func (v *CallSite) IsValid() error
- func (v *CallSite) MarshalBinary() ([]byte, error)
- func (v *CallSite) UnmarshalBinary(data []byte) error
- func (v *CallSite) UnmarshalBinaryFrom(rd io.Reader) error
- type Error
- type ErrorBase
- func (e *ErrorBase[Status]) CodeID() uint64
- func (v *ErrorBase[Status]) Copy() *ErrorBase[Status]
- func (v *ErrorBase[Status]) CopyAsInterface() interface{}
- func (v *ErrorBase[Status]) Equal(u *ErrorBase[Status]) bool
- func (e *ErrorBase[Status]) Error() string
- func (e *ErrorBase[Status]) Format(f fmt.State, verb rune)
- func (e *ErrorBase[Status]) Is(target error) bool
- func (v *ErrorBase[Status]) IsValid() error
- func (v *ErrorBase[Status]) MarshalBinary() ([]byte, error)
- func (v *ErrorBase[Status]) MarshalJSON() ([]byte, error)
- func (e *ErrorBase[Status]) Print() string
- func (e *ErrorBase[Status]) PrintFullCallstack() string
- func (v *ErrorBase[Status]) UnmarshalBinary(data []byte) error
- func (v *ErrorBase[Status]) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *ErrorBase[Status]) UnmarshalJSON(data []byte) error
- func (e *ErrorBase[Status]) Unwrap() error
- type Factory
- func (f Factory[Status]) With(v ...interface{}) *ErrorBase[Status]
- func (f Factory[Status]) WithCauseAndFormat(cause error, format string, args ...interface{}) *ErrorBase[Status]
- func (f Factory[Status]) WithFormat(format string, args ...interface{}) *ErrorBase[Status]
- func (f Factory[Status]) Wrap(err error) error
- type Status
- func (s Status) Delivered() bool
- func (s Status) Error() string
- func (v Status) GetEnumValue() uint64
- func (s Status) IsClientError() bool
- func (s Status) IsKnownError() bool
- func (s Status) IsServerError() bool
- func (v Status) MarshalJSON() ([]byte, error)
- func (v *Status) SetEnumValue(id uint64) bool
- func (s Status) Skip(n int) Factory[Status]
- func (v Status) String() string
- func (s Status) Success() bool
- func (v *Status) UnmarshalJSON(data []byte) error
- func (s Status) With(v ...interface{}) *Error
- func (s Status) WithCauseAndFormat(cause error, format string, args ...interface{}) *Error
- func (s Status) WithFormat(format string, args ...interface{}) *Error
- func (s Status) Wrap(err error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLocationTracking ¶
func DisableLocationTracking()
func EnableLocationTracking ¶
func EnableLocationTracking()
Types ¶
type CallSite ¶
type CallSite struct { FuncName string `json:"funcName,omitempty" form:"funcName" query:"funcName" validate:"required"` File string `json:"file,omitempty" form:"file" query:"file" validate:"required"` Line int64 `json:"line,omitempty" form:"line" query:"line" validate:"required"` // contains filtered or unexported fields }
func (*CallSite) CopyAsInterface ¶
func (v *CallSite) CopyAsInterface() interface{}
func (*CallSite) MarshalBinary ¶
func (*CallSite) UnmarshalBinary ¶
type ErrorBase ¶ added in v1.3.0
type ErrorBase[Status statusType] struct { Message string `json:"message,omitempty" form:"message" query:"message" validate:"required"` Code Status `json:"code,omitempty" form:"code" query:"code" validate:"required"` Cause *ErrorBase[Status] `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"` CallStack []*CallSite `json:"callStack,omitempty" form:"callStack" query:"callStack" validate:"required"` Data json.RawMessage `json:"data,omitempty" form:"data" query:"data" validate:"required"` // contains filtered or unexported fields }
func (*ErrorBase[Status]) CopyAsInterface ¶ added in v1.3.0
func (v *ErrorBase[Status]) CopyAsInterface() interface{}
func (*ErrorBase[Status]) MarshalBinary ¶ added in v1.3.0
func (*ErrorBase[Status]) MarshalJSON ¶ added in v1.3.0
func (*ErrorBase[Status]) Print ¶ added in v1.3.0
Print prints an error message plus its call stack and causal chain. Compound errors are usually formatted as '<description>: <cause>'. Print will print this out as:
<description>: <call stack> <cause> <call stack>
func (*ErrorBase[Status]) PrintFullCallstack ¶ added in v1.3.0
func (*ErrorBase[Status]) UnmarshalBinary ¶ added in v1.3.0
func (*ErrorBase[Status]) UnmarshalBinaryFrom ¶ added in v1.3.0
func (*ErrorBase[Status]) UnmarshalJSON ¶ added in v1.3.0
type Factory ¶ added in v1.3.0
type Factory[Status statusType] struct { Skip int Code Status UnknownCode Status EncodingCode Status }
func (Factory[Status]) WithCauseAndFormat ¶ added in v1.3.0
func (Factory[Status]) WithFormat ¶ added in v1.3.0
type Status ¶
type Status uint64
Status is a request status code.
const BadRequest Status = 400
BadRequest means the request was invalid.
const BadSignerVersion Status = 411
BadSignerVersion means the signer version does not match.
const BadTimestamp Status = 412
BadTimestamp means the timestamp is invalid.
const BadUrlLength Status = 413
BadUrlLength means the url length is too big.
const Conflict Status = 409
Conflict means the request failed due to a conflict.
const Delivered Status = 201
Delivered means the transaction has been delivered.
const EncodingError Status = 502
EncodingError means encoding or decoding failed.
const Expired Status = 407
Expired is returned when a transaction has expired.
const FatalError Status = 503
FatalError means something has gone seriously wrong.
const IncompleteChain Status = 414
IncompleteChain means the chain does not include the full history.
const InsufficientBalance Status = 415
InsufficientBalance means the account balance is insufficient to satisfy the request.
const InsufficientCredits Status = 402
InsufficientCredits means the signer does not have sufficient credits to execute the transaction.
const InternalError Status = 500
InternalError means an internal error occurred.
const InvalidRecord Status = 508
InvalidRecord means the database has one or more invalid records.
const NoPeer Status = 506
NoPeer means the receiver cannot find a peer to satisfy the request.
const NotAllowed Status = 405
NotAllowed means the requested action could not be performed.
const NotFound Status = 404
NotFound means a record could not be found.
const NotReady Status = 504
NotReady means the receiver is not ready to satisfy the request.
const OK Status = 200
OK means the request completed successfully.
const PeerMisbehaved Status = 507
PeerMisbehaved means a peer behaved incorrectly.
const Pending Status = 202
Pending means the transaction is pending.
const Rejected Status = 406
Rejected is returned when a transaction is rejected.
const Remote Status = 203
Remote means the transaction is a local reference to a remote.
const Unauthenticated Status = 401
Unauthenticated means the signature could not be validated.
Unauthorized means the signer is not authorized to sign the transaction.
const UnknownError Status = 501
UnknownError means an unknown error occurred.
const WrongPartition Status = 301
WrongPartition means the requested resource is assigned to a different network partition.
const WrongType Status = 505
WrongType means the record is not the expected type.
func StatusByName ¶
StatusByName returns the named Status.
func (Status) Delivered ¶ added in v1.1.0
Delivered returns true if the status represents an executed transaction.
func (Status) GetEnumValue ¶
GetEnumValue returns the value of the Status
func (Status) IsClientError ¶ added in v1.1.0
IsClientError returns true if the status is a server error.
func (Status) IsKnownError ¶ added in v1.1.0
IsKnownError returns true if the status is non-zero and not UnknownError.
func (Status) IsServerError ¶ added in v1.1.0
IsServerError returns true if the status is a server error.
func (Status) MarshalJSON ¶
MarshalJSON marshals the Status to JSON as a string.
func (*Status) SetEnumValue ¶
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (*Status) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Status from JSON as a string.