lang: ast, download: Improve error messages
This commit is contained in:
@@ -3403,7 +3403,8 @@ func (obj *StmtProg) importScope(info *interfaces.ImportData, scope *interfaces.
|
|||||||
if obj.data.Downloader != nil {
|
if obj.data.Downloader != nil {
|
||||||
// run downloader stuff first
|
// run downloader stuff first
|
||||||
if err := obj.data.Downloader.Get(info, modulesPath); err != nil {
|
if err := obj.data.Downloader.Get(info, modulesPath); err != nil {
|
||||||
return nil, errwrap.Wrapf(err, "download of `%s` failed", info.Name)
|
obj.data.Logf("download of `%s` failed", info.Name)
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3773,7 +3774,8 @@ func (obj *StmtProg) SetScope(scope *interfaces.Scope) error {
|
|||||||
// run the scope importer...
|
// run the scope importer...
|
||||||
importedScope, err := obj.importScope(result, scope)
|
importedScope, err := obj.importScope(result, scope)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errwrap.Wrapf(err, "import scope `%s` failed", imp.Name)
|
obj.data.Logf("import scope `%s` failed", imp.Name)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// read from stored scope which was previously saved in SetScope
|
// read from stored scope which was previously saved in SetScope
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func (obj *Downloader) Get(info *interfaces.ImportData, modulesPath string) erro
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return fmt.Errorf("module path (`%s`) must be a dir", modulesPath)
|
return fmt.Errorf("module path (`%s`) must be a dir", modulesPath)
|
||||||
}
|
}
|
||||||
if err == os.ErrNotExist {
|
if os.IsNotExist(err) {
|
||||||
return fmt.Errorf("module path (`%s`) must exist", modulesPath)
|
return fmt.Errorf("module path (`%s`) must exist", modulesPath)
|
||||||
}
|
}
|
||||||
return errwrap.Wrapf(err, "could not read module path (`%s`)", modulesPath)
|
return errwrap.Wrapf(err, "could not read module path (`%s`)", modulesPath)
|
||||||
@@ -164,6 +164,9 @@ func (obj *Downloader) Get(info *interfaces.ImportData, modulesPath string) erro
|
|||||||
if err != nil && err != git.NoErrAlreadyUpToDate {
|
if err != nil && err != git.NoErrAlreadyUpToDate {
|
||||||
return errwrap.Wrapf(err, "can't pull latest from: `%s`", info.URL)
|
return errwrap.Wrapf(err, "can't pull latest from: `%s`", info.URL)
|
||||||
}
|
}
|
||||||
|
if err == git.NoErrAlreadyUpToDate {
|
||||||
|
obj.info.Logf("repo already up to date!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: checkout requested sha1/tag if one was specified...
|
// TODO: checkout requested sha1/tag if one was specified...
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ print "unused" {
|
|||||||
msg => "i'm unused because i'm inside an imported module",
|
msg => "i'm unused because i'm inside an imported module",
|
||||||
}
|
}
|
||||||
-- OUTPUT --
|
-- OUTPUT --
|
||||||
# err: errSetScope: import scope `something.mcl` failed: local import of `something.mcl` failed: module contains unused statements: found stmt: res(print)
|
# err: errSetScope: local import of `something.mcl` failed: module contains unused statements: found stmt: res(print)
|
||||||
|
|||||||
Reference in New Issue
Block a user