Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9efb92a

Browse files
committed
fix: improve error handling in AddSketchLibrary by logging warnings for library index update failures
1 parent4ef6145 commit9efb92a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

‎internal/orchestrator/sketch_libs.go‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package orchestrator
1717

1818
import (
1919
"context"
20-
"fmt"
2120
"log/slog"
2221
"time"
2322

@@ -48,15 +47,15 @@ func AddSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryRel
4847
returnnil,err
4948
}
5049

51-
// update the local library_index if it is older than a certain threshold, to ensure the library is found when added by the arduino-cli
52-
stream,res:=commands.UpdateLibrariesIndexStreamResponseToCallbackFunction(ctx,func(curr*rpc.DownloadProgress) {
53-
slog.Debug("downloading library index","progress",curr.Message)
50+
stream,_:=commands.UpdateLibrariesIndexStreamResponseToCallbackFunction(ctx,func(curr*rpc.DownloadProgress) {
51+
slog.Debug("downloading library index","progress",curr.GetMessage())
5452
})
53+
// update the local library index after a certain time, to avoid if a library is added to the sketch but the local library index is not update, the compile can fail (because the lib is not found)
5554
req:=&rpc.UpdateLibrariesIndexRequest{Instance:inst,UpdateIfOlderThanSecs:int64(indexUpdateInterval.Seconds())}
5655
iferr:=srv.UpdateLibrariesIndex(req,stream);err!=nil {
57-
return []LibraryReleaseID{},fmt.Errorf("error updating library index: %v",err)
56+
// ignore the error because a missing connection should not stop the user from adding a library.
57+
slog.Warn("error updating library index",slog.String("error",err.Error()))
5858
}
59-
slog.Debug("Library index update","status",res().GetLibrariesIndex().GetStatus())
6059

6160
resp,err:=srv.ProfileLibAdd(ctx,&rpc.ProfileLibAddRequest{
6261
Instance:inst,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp