@@ -97,7 +97,7 @@ func Init(ctx context.Context, req *rpc.InitReq) (*rpc.InitResp, error) {
97
97
}
98
98
pm , lm , err := createInstance (ctx , config , req .GetLibraryManagerOnly ())
99
99
if err != nil {
100
- return nil , fmt .Errorf ("Impossible create instance" )
100
+ return nil , fmt .Errorf ("cannot initialize package manager: %s" , err )
101
101
}
102
102
instance := & CoreInstance {
103
103
config : config ,
@@ -161,35 +161,34 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexReq, downloadCB Downlo
161
161
162
162
tmpFile , err := ioutil .TempFile ("" , "" )
163
163
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 )
166
165
}
167
166
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 )
169
168
}
170
169
tmp := paths .New (tmpFile .Name ())
171
170
defer tmp .Remove ()
172
171
173
172
d , err := downloader .Download (tmp .String (), URL .String ())
174
173
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 )
176
175
}
177
176
coreIndexPath := indexpath .Join (path .Base (URL .Path ))
178
177
Download (d , "Updating index: " + coreIndexPath .Base (), downloadCB )
179
178
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 ())
181
180
}
182
181
183
182
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 )
185
184
}
186
185
187
186
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 )
189
188
}
190
189
191
190
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 )
193
192
}
194
193
}
195
194
Rescan (ctx , & rpc.RescanReq {Instance : req .Instance })
@@ -205,7 +204,7 @@ func Rescan(ctx context.Context, req *rpc.RescanReq) (*rpc.RescanResp, error) {
205
204
206
205
pm , lm , err := createInstance (ctx , coreInstance .config , coreInstance .getLibOnly )
207
206
if err != nil {
208
- return nil , fmt .Errorf ("rescanning: %s" , err )
207
+ return nil , fmt .Errorf ("rescanning filesystem : %s" , err )
209
208
}
210
209
coreInstance .pm = pm
211
210
coreInstance .lm = lm
0 commit comments