errtypes.go 447 B

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