@@ -153,7 +153,7 @@ func (s *ArduinoCoreServerImpl) BoardAttach(req *rpc.BoardAttachRequest, stream
153153// Destroy FIXMEDOC
154154func (s * ArduinoCoreServerImpl ) Destroy (ctx context.Context , req * rpc.DestroyRequest ) (* rpc.DestroyResponse , error ) {
155155 resp , err := commands .Destroy (ctx , req )
156- return resp , err . Err ( )
156+ return resp , convertErrorToRPCStatus ( err )
157157}
158158
159159// UpdateIndex FIXMEDOC
@@ -162,7 +162,7 @@ func (s *ArduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
162162 func (p * rpc.DownloadProgress ) { stream .Send (& rpc.UpdateIndexResponse {DownloadProgress : p }) },
163163 )
164164 if err != nil {
165- return err . Err ( )
165+ return convertErrorToRPCStatus ( err )
166166 }
167167 return stream .Send (resp )
168168}
@@ -173,7 +173,7 @@ func (s *ArduinoCoreServerImpl) UpdateLibrariesIndex(req *rpc.UpdateLibrariesInd
173173 func (p * rpc.DownloadProgress ) { stream .Send (& rpc.UpdateLibrariesIndexResponse {DownloadProgress : p }) },
174174 )
175175 if err != nil {
176- return err . Err ( )
176+ return convertErrorToRPCStatus ( err )
177177 }
178178 return stream .Send (& rpc.UpdateLibrariesIndexResponse {})
179179}
@@ -184,15 +184,15 @@ func (s *ArduinoCoreServerImpl) UpdateCoreLibrariesIndex(req *rpc.UpdateCoreLibr
184184 func (p * rpc.DownloadProgress ) { stream .Send (& rpc.UpdateCoreLibrariesIndexResponse {DownloadProgress : p }) },
185185 )
186186 if err != nil {
187- return err . Err ( )
187+ return convertErrorToRPCStatus ( err )
188188 }
189189 return stream .Send (& rpc.UpdateCoreLibrariesIndexResponse {})
190190}
191191
192192// Outdated FIXMEDOC
193193func (s * ArduinoCoreServerImpl ) Outdated (ctx context.Context , req * rpc.OutdatedRequest ) (* rpc.OutdatedResponse , error ) {
194194 resp , err := commands .Outdated (ctx , req )
195- return resp , err . Err ( )
195+ return resp , convertErrorToRPCStatus ( err )
196196}
197197
198198// Upgrade FIXMEDOC
@@ -210,29 +210,23 @@ func (s *ArduinoCoreServerImpl) Upgrade(req *rpc.UpgradeRequest, stream rpc.Ardu
210210 },
211211 )
212212 if err != nil {
213- return err . Err ( )
213+ return convertErrorToRPCStatus ( err )
214214 }
215215 return stream .Send (& rpc.UpgradeResponse {})
216216}
217217
218218// Create FIXMEDOC
219219func (s * ArduinoCoreServerImpl ) Create (_ context.Context , req * rpc.CreateRequest ) (* rpc.CreateResponse , error ) {
220- res , status := commands .Create (req )
221- if status != nil {
222- return nil , status .Err ()
223- }
224- return res , nil
220+ res , err := commands .Create (req )
221+ return res , convertErrorToRPCStatus (err )
225222}
226223
227224// Init FIXMEDOC
228225func (s * ArduinoCoreServerImpl ) Init (req * rpc.InitRequest , stream rpc.ArduinoCoreService_InitServer ) error {
229226 err := commands .Init (req , func (message * rpc.InitResponse ) {
230227 stream .Send (message )
231228 })
232- if err != nil {
233- return err .Err ()
234- }
235- return nil
229+ return convertErrorToRPCStatus (err )
236230}
237231
238232// Version FIXMEDOC
@@ -243,7 +237,7 @@ func (s *ArduinoCoreServerImpl) Version(ctx context.Context, req *rpc.VersionReq
243237// LoadSketch FIXMEDOC
244238func (s * ArduinoCoreServerImpl ) LoadSketch (ctx context.Context , req * rpc.LoadSketchRequest ) (* rpc.LoadSketchResponse , error ) {
245239 resp , err := commands .LoadSketch (ctx , req )
246- return resp , err . Err ( )
240+ return resp , convertErrorToRPCStatus ( err )
247241}
248242
249243// Compile FIXMEDOC
0 commit comments