Skip to content

Commit 518a332

Browse files
committed
Fixed some error messages
1 parent 1711a26 commit 518a332

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

commands/instances.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func Init(ctx context.Context, req *rpc.InitReq) (*rpc.InitResp, error) {
9797
}
9898
pm, lm, err := createInstance(ctx, config, req.GetLibraryManagerOnly())
9999
if err != nil {
100-
return nil, fmt.Errorf("Impossible create instance")
100+
return nil, fmt.Errorf("cannot initialize package manager: %s", err)
101101
}
102102
instance := &CoreInstance{
103103
config: config,
@@ -161,35 +161,34 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexReq, downloadCB Downlo
161161

162162
tmpFile, err := ioutil.TempFile("", "")
163163
if err != nil {
164-
return nil, fmt.Errorf("Error creating temp file for download", err)
165-
164+
return nil, fmt.Errorf("creating temp file for download: %s", err)
166165
}
167166
if err := tmpFile.Close(); err != nil {
168-
return nil, fmt.Errorf("Error creating temp file for download", err)
167+
return nil, fmt.Errorf("creating temp file for download: %s", err)
169168
}
170169
tmp := paths.New(tmpFile.Name())
171170
defer tmp.Remove()
172171

173172
d, err := downloader.Download(tmp.String(), URL.String())
174173
if err != nil {
175-
return nil, fmt.Errorf("Error downloading index "+URL.String(), err)
174+
return nil, fmt.Errorf("downloading index %s: %s", URL, err)
176175
}
177176
coreIndexPath := indexpath.Join(path.Base(URL.Path))
178177
Download(d, "Updating index: "+coreIndexPath.Base(), downloadCB)
179178
if d.Error() != nil {
180-
return nil, fmt.Errorf("Error downloading index "+URL.String(), d.Error())
179+
return nil, fmt.Errorf("downloading index %s: %s", URL, d.Error())
181180
}
182181

183182
if _, err := packageindex.LoadIndex(tmp); err != nil {
184-
return nil, fmt.Errorf("Invalid package index in "+URL.String(), err)
183+
return nil, fmt.Errorf("invalid package index in %s: %s", URL, err)
185184
}
186185

187186
if err := indexpath.MkdirAll(); err != nil {
188-
return nil, fmt.Errorf("Can't create data directory "+indexpath.String(), err)
187+
return nil, fmt.Errorf("can't create data directory %s: %s", indexpath, err)
189188
}
190189

191190
if err := tmp.CopyTo(coreIndexPath); err != nil {
192-
return nil, fmt.Errorf("Error saving downloaded index "+URL.String(), err)
191+
return nil, fmt.Errorf("saving downloaded index %s: %s", URL, err)
193192
}
194193
}
195194
Rescan(ctx, &rpc.RescanReq{Instance: req.Instance})
@@ -205,7 +204,7 @@ func Rescan(ctx context.Context, req *rpc.RescanReq) (*rpc.RescanResp, error) {
205204

206205
pm, lm, err := createInstance(ctx, coreInstance.config, coreInstance.getLibOnly)
207206
if err != nil {
208-
return nil, fmt.Errorf("rescanning: %s", err)
207+
return nil, fmt.Errorf("rescanning filesystem: %s", err)
209208
}
210209
coreInstance.pm = pm
211210
coreInstance.lm = lm

0 commit comments

Comments
 (0)