Meaningful error message when fetch request is received for a package when build is not successful. (#661)
This commit is contained in:
committed by
Ta-Ching Chen
parent
2ece0db13f
commit
f0dc2554a1
@@ -254,6 +254,15 @@ func (fetcher *Fetcher) Fetch(req FetchRequest) (int, error) {
|
||||
if req.FetchType == FETCH_SOURCE {
|
||||
archive = &pkg.Spec.Source
|
||||
} else if req.FetchType == FETCH_DEPLOYMENT {
|
||||
// sometimes, the user may invoke the function even before the source code is built into a deploy pkg.
|
||||
// this results in executor sending a fetch request of type FETCH_DEPLOYMENT and since pkg.Spec.Deployment.Url will be empty,
|
||||
// we hit this "Get : unsupported protocol scheme "" error.
|
||||
// it may be useful to the user if we can send a more meaningful error in such a scenario.
|
||||
if pkg.Status.BuildStatus != fission.BuildStatusSucceeded && pkg.Status.BuildStatus != fission.BuildStatusNone {
|
||||
e := fmt.Sprintf("Build status for the function's pkg : %s.%s is : %s, can't fetch deployment", pkg.Metadata.Name, pkg.Metadata.Namespace, pkg.Status.BuildStatus)
|
||||
log.Printf(e)
|
||||
return 500, errors.New(e)
|
||||
}
|
||||
archive = &pkg.Spec.Deployment
|
||||
}
|
||||
// get package data as literal or by url
|
||||
|
||||
Reference in New Issue
Block a user