Better errors
This commit is contained in:
parent
929214e4dd
commit
06b4ee7d27
1 changed files with 2 additions and 2 deletions
4
main.go
4
main.go
|
@ -235,13 +235,13 @@ func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.In
|
||||||
test, ok := prediction.([]interface{})
|
test, ok := prediction.([]interface{})
|
||||||
|
|
||||||
if !ok {
|
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)
|
imgUrl, ok := test[0].(string)
|
||||||
|
|
||||||
if !ok {
|
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)
|
imageRes, imageGetErr := http.Get(imgUrl)
|
||||||
|
|
Loading…
Add table
Reference in a new issue