Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
errors.go 1.35 KiB
package nucleus

import (
	"fmt"
	"reflect"
)

type ErrNilClient struct {
}

func (e *ErrNilClient) Error() string {
	return fmt.Sprintf("client cannot be nil")
}

type ErrNil struct {
}

func (e *ErrNil) Error() string {
	return fmt.Sprintf("struct cannot be nil")
}

type ErrNotFound struct {
	id interface{}
}

func (e *ErrNotFound) Error() string {
	return fmt.Sprintf("%v not found", e.id)
}

type ErrAlreadyExists struct {
	item interface{}
}

func (e *ErrAlreadyExists) Error() string {
	return fmt.Sprintf("%v already exists", e.item)
}

type ErrInvalidTypeAssertion struct {
	v interface{}
	t interface{}
}

func (e ErrInvalidTypeAssertion) Error() string {
	return fmt.Sprintf("%v does not implement %v", e.v, e.t)
}

type ErrUnsupportedPath struct {
	p interface{}
}

func (e ErrUnsupportedPath) Error() string {
	return fmt.Sprintf("path %v is not supported", e.p)
}

type ErrNotYetImplemented struct{}

func (e ErrNotYetImplemented) Error() string {
	return fmt.Sprintf("function not yet implemented")
}

type ErrInvalidParameters struct {
	f interface{}
	r interface{}
}

func (e ErrInvalidParameters) Error() string {
	return fmt.Sprintf("invalid parameters for %v: %v", e.f, e.r)
}

type ErrInvalidTransportOptions struct {
	t interface{}
}

func (e ErrInvalidTransportOptions) Error() string {
	return fmt.Sprintf("invalid transport options: %v", reflect.TypeOf(e.t))
}