error

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientIDTaskNotFound = iota + 1000
	ClientIDInput
	ClientIDRunNotFound
	ClientIDRunCannotDelete
	ClientUnknownApiKey
)
View Source
const (
	ServerIDDefault = iota + 2000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Client indicates that this is a client error.
	Client()
	// Error implements [error].
	// It returns the human-readable message of the error.
	Error() string
	// ErrorID returns the internal identifier of the error.
	ErrorID() int
	// ToApiError is a helper method that maps the error to an [codeberg.org/saturn-sync/saturn/pkg/server/api/openapi.Error].
	ToApiError() openapi.Error
}

Client defines an interface for errors caused by invalid inputs sent by a client.

func NewRunCannotDeleteError

func NewRunCannotDeleteError() Client

NewRunCannotDeleteError returns a client error that indicates that the run cannot be deleted.

func NewRunNotFoundError

func NewRunNotFoundError(id int) Client

NewTaskNotFoundError returns a client error that indicates that the run identified by id doesn't exist.

func NewTaskNotFoundError

func NewTaskNotFoundError(taskName string) Client

NewTaskNotFoundError returns a client error that indicates that a task hasn't been found.

type InputError

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

InputError is a specific implementation of Client. It wraps all errors that occurred during validation of inputs.

func NewInputError

func NewInputError(errors []error, taskName string) InputError

NewInputError returns a client error that indicates that an expected input of a task isn't set.

func (InputError) Client

func (e InputError) Client()

Client implements Client.

func (InputError) Error

func (e InputError) Error() string

Error implements error.

func (InputError) ErrorID

func (e InputError) ErrorID() int

ErrorID implements Client.

func (InputError) ToApiError

func (e InputError) ToApiError() openapi.Error

ToApiError implements Client.

Jump to

Keyboard shortcuts

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