Better errors

This commit is contained in:
Atridad Lahiji 2024-01-07 14:36:15 -07:00
parent 929214e4dd
commit 06b4ee7d27
No known key found for this signature in database

View file

@ -235,13 +235,13 @@ func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.In
test, ok := prediction.([]interface{})
if !ok {
return errorResponse(errors.New("prediction is not []interface{}"))
return errorResponse(errors.New("there was an error generating the image based on this prompt... this usually happens when the generated image violates safety requirements"))
}
imgUrl, ok := test[0].(string)
if !ok {
return errorResponse(errors.New("prediction.Output[0] is not a string"))
return errorResponse(errors.New("there was an error generating the image based on this prompt... this usually happens when the generated image violates safety requirements"))
}
imageRes, imageGetErr := http.Get(imgUrl)