errtypes.go 447 B

123456789101112131415161718192021
  1. // Package errtypes contains custom error types
  2. package errtypes
  3. import (
  4. "fmt"
  5. "strings"
  6. )
  7. const (
  8. UnknownOllamaKeyErrMsg = "unknown ollama key"
  9. InvalidModelNameErrMsg = "invalid model name"
  10. )
  11. // TODO: This should have a structured response from the API
  12. type UnknownOllamaKey struct {
  13. Key string
  14. }
  15. func (e *UnknownOllamaKey) Error() string {
  16. return fmt.Sprintf("unauthorized: %s %q", UnknownOllamaKeyErrMsg, strings.TrimSpace(e.Key))
  17. }