Skip to content
Snippets Groups Projects
errors.go 1.35 KiB
Newer Older
  • Learn to ignore specific revisions
  • package nucleus
    
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    import (
    	"fmt"
    	"reflect"
    )
    
    
    type ErrNilClient struct {
    }
    
    
    func (e *ErrNilClient) Error() string {
    
    	return fmt.Sprintf("client cannot be nil")
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    type ErrNil struct {
    }
    
    func (e *ErrNil) Error() string {
    	return fmt.Sprintf("struct cannot be nil")
    }
    
    
    type ErrNotFound struct {
    
    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)
    }
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    
    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))