Skip to content

Commit e625d65

Browse files
committed
Better error messages
1 parent 2327b35 commit e625d65

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

commands/service_profile_lib_remove.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s *arduinoCoreServerImpl) ProfileLibRemove(ctx context.Context, req *rpc.P
5454
remove := func(libraryToRemove *sketch.ProfileLibraryReference) error {
5555
removedLibrary, err := profile.RemoveLibrary(libraryToRemove)
5656
if err != nil {
57-
return &cmderrors.InvalidArgumentError{Cause: err}
57+
return &cmderrors.InvalidArgumentError{Message: "could not remove library", Cause: err}
5858
}
5959
removedLibraries = append(removedLibraries, removedLibrary.ToRpc())
6060
return nil
@@ -101,7 +101,7 @@ func (s *arduinoCoreServerImpl) ProfileLibRemove(ctx context.Context, req *rpc.P
101101

102102
depsOfLibToRemove, err := libraryResolveDependencies(li, libToRemove.Library, libToRemove.Version.String(), nil)
103103
if err != nil {
104-
return nil, err
104+
return nil, &cmderrors.InvalidArgumentError{Cause: err, Message: "cannot resolve dependencies for installed libraries"}
105105
}
106106
// sort to make the output order deterministic
107107
slices.SortFunc(depsOfLibToRemove, librariesindex.ReleaseCompare)
@@ -118,7 +118,7 @@ func (s *arduinoCoreServerImpl) ProfileLibRemove(ctx context.Context, req *rpc.P
118118

119119
err = projectFilePath.WriteFile([]byte(sk.Project.AsYaml()))
120120
if err != nil {
121-
return nil, err
121+
return nil, &cmderrors.CantUpdateSketchError{Cause: err}
122122
}
123123

124124
return &rpc.ProfileLibRemoveResponse{

0 commit comments

Comments
 (0)