Unverified Commit af4cf558 authored by Bruce MacDonald's avatar Bruce MacDonald Committed by GitHub
Browse files

not found error before pulling model (#718)

parent d6786f29
...@@ -3,8 +3,10 @@ package server ...@@ -3,8 +3,10 @@ package server
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"io/fs"
"log" "log"
"net" "net"
"net/http" "net/http"
...@@ -170,6 +172,11 @@ func GenerateHandler(c *gin.Context) { ...@@ -170,6 +172,11 @@ func GenerateHandler(c *gin.Context) {
model, err := GetModel(req.Model) model, err := GetModel(req.Model)
if err != nil { if err != nil {
var pErr *fs.PathError
if errors.As(err, &pErr) {
c.JSON(http.StatusNotFound, gin.H{"error": fmt.Sprintf("model '%s' not found, try pulling it first", req.Model)})
return
}
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return return
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment