Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package aiprompts
|
||||
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
ErrInvalidKey = errors.New("invalid prompt key")
|
||||
ErrInvalidInput = errors.New("invalid prompt input")
|
||||
)
|
||||
|
||||
// ClientError maps known client errors to safe API messages.
|
||||
func ClientError(err error) (msg string, ok bool) {
|
||||
switch {
|
||||
case errors.Is(err, ErrInvalidKey):
|
||||
return "invalid prompt key", true
|
||||
case errors.Is(err, ErrInvalidInput):
|
||||
return "invalid prompt templates", true
|
||||
default:
|
||||
// Wrapped ErrInvalidKey / ErrInvalidInput from fmt.Errorf("%w: …")
|
||||
if errors.Is(err, ErrInvalidKey) {
|
||||
return err.Error(), true
|
||||
}
|
||||
if errors.Is(err, ErrInvalidInput) {
|
||||
return err.Error(), true
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user