[minor] return a better error response in manifestLoaders list fail

This commit is contained in:
Aaron Meihm 2016-02-24 09:42:55 -06:00
Родитель 3e54d93cf4
Коммит f3e60cb772
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -260,7 +260,17 @@ func manifestLoaders(respWriter http.ResponseWriter, request *http.Request) {
}
ldrs, err := ctx.DB.AllLoadersFromManifestID(mid)
if err != nil {
panic(err)
// If we fail here, it could be because no matching loaders were
// found or the where clause specified withi the manifest is
// invalid. Just return a generic error message here but also
// log the actual error.
ctx.Channels.Log <- mig.Log{OpID: opid,
Desc: fmt.Sprintf("Error selecting loaders from manifest %v: %v", mid, err)}
resource.SetError(cljs.Error{
Code: fmt.Sprintf("%.0f", opid),
Message: fmt.Sprintf("No matching loaders for manifest '%.0f'", mid)})
respond(404, resource, respWriter, request)
return
}
li, err := loaderEntrysToItem(ldrs, mid, ctx)
if err != nil {