ollama/types/errtypes/errtypes.go

22 lines
447 B
Go
Raw Normal View History

// Package errtypes contains custom error types
package errtypes
import (
"fmt"
"strings"
)
2024-08-01 21:52:15 +00:00
const (
UnknownOllamaKeyErrMsg = "unknown ollama key"
InvalidModelNameErrMsg = "invalid model name"
)
// TODO: This should have a structured response from the API
type UnknownOllamaKey struct {
Key string
}
func (e *UnknownOllamaKey) Error() string {
return fmt.Sprintf("unauthorized: %s %q", UnknownOllamaKeyErrMsg, strings.TrimSpace(e.Key))
}