errtypes.go 395 B

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