errors

package module
v0.0.0-...-7447419 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: AGPL-3.0 Imports: 3 Imported by: 2

Documentation

Overview

Error defines all errors that may happen when using the Sandwich Go library. It uses the error codes defined in the protobuf.

Error defines all errors that may happen when using the Sandwich Go library. It uses the error codes defined in the protobuf.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(chain *swc.Error) error

createError creates a chain of errors, returned from Sandwich.

Types

type ALPNError

type ALPNError struct {
	BaseError
}

func NewALPNError

func NewALPNError(code pb.ALPNError, msg string) *ALPNError

type APIError

type APIError struct {
	BaseError
}

func NewAPIError

func NewAPIError(code pb.APIError, msg string) *APIError

type ASN1Error

type ASN1Error struct {
	BaseError
}

func NewASN1Error

func NewASN1Error(code pb.ASN1Error, msg string) *ASN1Error

type BaseError

type BaseError struct {
	// contains filtered or unexported fields
}

BaseError represents the base structure for all Sandwich errors.

func (*BaseError) Code

func (err *BaseError) Code() int32

Code implements the Error interface.

func (*BaseError) Error

func (err *BaseError) Error() string

Error implements the error interface.

func (*BaseError) Unwrap

func (err *BaseError) Unwrap() error

Unwrap implements the Error interface.

type CertificateError

type CertificateError struct {
	BaseError
}

func NewCertificateError

func NewCertificateError(code pb.CertificateError, msg string) *CertificateError

type ConfigurationError

type ConfigurationError struct {
	BaseError
}

func NewConfigurationError

func NewConfigurationError(code pb.ConfigurationError, msg string) *ConfigurationError

type DataSourceError

type DataSourceError struct {
	BaseError
}

func NewDataSourceError

func NewDataSourceError(code pb.DataSourceError, msg string) *DataSourceError

type Error

type Error interface {
	// Error extends the builtin `error` interface.
	error
	// `Code` returns the error code, defined in the protobuf.
	Code() int32

	// `Unwrap` unwraps the next error. It is meant to be used with the `errors`
	// package.
	Unwrap() error
	// contains filtered or unexported methods
}

Error represents the interface for all Sandwich errors.

type HandshakeError

type HandshakeError struct {
	BaseError
}

func NewHandshakeError

func NewHandshakeError(code pb.HandshakeError, msg string) *HandshakeError

type HandshakeStateError

type HandshakeStateError struct {
	BaseError
}

HandshakeStateError defines errors that take place during the handshake stage. These states are defined by the enum `HandshakeState` in `tunnel.proto`. They are used by `Tunnel.Handshake`.

func NewHandshakeStateError

func NewHandshakeStateError(code int32, msg string) *HandshakeStateError

NewHandshakeStateError creates an error from an error code. The error code is supposed to match a key in `handshakeStateErrorMap`, defined above.

func NewHandshakeStateErrorFromEnum

func NewHandshakeStateErrorFromEnum(err pb.HandshakeState) *HandshakeStateError

NewHandshakeErrorFromEnum creates an error from the enum pb.HandshakeState.

type IOError

type IOError struct {
	BaseError
}

IOError defines the error that can happens during the i/o operations done by an I/O interface. These errors are defined by the enum `IOError` in `io.proto`.

func NewIOError

func NewIOError(code int32, msg string) *IOError

NewIOError creates an error from an error code. The error code is supposed to match a key in `ioErrorMap`, defined above. This function is publicly exposed, as it is meant to be used by the user to implement their own I/O interface.

func NewIOErrorFromEnum

func NewIOErrorFromEnum(err pb.IOError) *IOError

NewIOErrorFromEnum creates an error from the enum pb.IOError.

type KEMError

type KEMError struct {
	BaseError
}

func NewKEMError

func NewKEMError(code pb.KEMError, msg string) *KEMError

type PrivateKeyError

type PrivateKeyError struct {
	BaseError
}

func NewPrivateKeyError

func NewPrivateKeyError(code pb.PrivateKeyError, msg string) *PrivateKeyError

type ProtobufError

type ProtobufError struct {
	BaseError
}

func NewProtobufError

func NewProtobufError(code pb.ProtobufError, msg string) *ProtobufError

type RecordPlaneError

type RecordPlaneError struct {
	BaseError
}

RecordPlaneError defines the error that can happens during the record plane. These errors are defined by the enum `RecordError` in `tunnel.proto`. They are used by `Tunnel.Write` and `Tunnel.Read`.

func NewRecordPlaneError

func NewRecordPlaneError(code int32, msg string) *RecordPlaneError

NewRecordPlaneError creates an error from an error code. The error code is supposed to match a key in `recordPlaneErrorMap`, defined above.

func NewRecordPlaneErrorFromEnum

func NewRecordPlaneErrorFromEnum(err pb.RecordError) *RecordPlaneError

NewRecordPlaneErrorFromEnum creates an error from the enum pb.RecordError.

type SocketError

type SocketError struct {
	BaseError
}

func NewSocketError

func NewSocketError(code pb.SocketError, msg string) *SocketError

type SystemError

type SystemError struct {
	BaseError
}

func NewSystemError

func NewSystemError(code pb.SystemError, msg string) *SystemError

type TLSConfigurationError

type TLSConfigurationError struct {
	BaseError
}

func NewTLSConfigurationError

func NewTLSConfigurationError(code pb.TLSConfigurationError, msg string) *TLSConfigurationError

type TunnelError

type TunnelError struct {
	BaseError
}

func NewTunnelError

func NewTunnelError(code pb.TunnelError, msg string) *TunnelError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL