Skip to content

Commit 7eb945d

Browse files
committed
fixed go lint warnings
1 parent e90e03b commit 7eb945d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Diff for: commands/errors.go

+34
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func composeErrorMsg(msg string, cause error) string {
3232

3333
// CommandError is an error that may be converted into a gRPC status.
3434
type CommandError interface {
35+
// ToRPCStatus convertes the error into a *status.Status
3536
ToRPCStatus() *status.Status
3637
}
3738

@@ -42,6 +43,7 @@ func (e *InvalidInstanceError) Error() string {
4243
return tr("Invalid instance")
4344
}
4445

46+
// ToRPCStatus convertes the error into a *status.Status
4547
func (e *InvalidInstanceError) ToRPCStatus() *status.Status {
4648
return status.New(codes.InvalidArgument, e.Error())
4749
}
@@ -55,6 +57,7 @@ func (e *InvalidFQBNError) Error() string {
5557
return composeErrorMsg(tr("Invalid FQBN"), e.Cause)
5658
}
5759

60+
// ToRPCStatus convertes the error into a *status.Status
5861
func (e *InvalidFQBNError) ToRPCStatus() *status.Status {
5962
return status.New(codes.InvalidArgument, e.Error())
6063
}
@@ -72,6 +75,7 @@ func (e *InvalidURLError) Error() string {
7275
return composeErrorMsg(tr("Invalid URL"), e.Cause)
7376
}
7477

78+
// ToRPCStatus convertes the error into a *status.Status
7579
func (e *InvalidURLError) ToRPCStatus() *status.Status {
7680
return status.New(codes.InvalidArgument, e.Error())
7781
}
@@ -89,6 +93,7 @@ func (e *InvalidLibraryError) Error() string {
8993
return composeErrorMsg(tr("Invalid library"), e.Cause)
9094
}
9195

96+
// ToRPCStatus convertes the error into a *status.Status
9297
func (e *InvalidLibraryError) ToRPCStatus() *status.Status {
9398
return status.New(codes.InvalidArgument, e.Error())
9499
}
@@ -106,6 +111,7 @@ func (e *InvalidVersionError) Error() string {
106111
return composeErrorMsg(tr("Invalid version"), e.Cause)
107112
}
108113

114+
// ToRPCStatus convertes the error into a *status.Status
109115
func (e *InvalidVersionError) ToRPCStatus() *status.Status {
110116
return status.New(codes.InvalidArgument, e.Error())
111117
}
@@ -121,6 +127,7 @@ func (e *MissingFQBNError) Error() string {
121127
return tr("Missing FQBN (Fully Qualified Board Name)")
122128
}
123129

130+
// ToRPCStatus convertes the error into a *status.Status
124131
func (e *MissingFQBNError) ToRPCStatus() *status.Status {
125132
return status.New(codes.InvalidArgument, e.Error())
126133
}
@@ -138,6 +145,7 @@ func (e *UnknownFQBNError) Unwrap() error {
138145
return e.Cause
139146
}
140147

148+
// ToRPCStatus convertes the error into a *status.Status
141149
func (e *UnknownFQBNError) ToRPCStatus() *status.Status {
142150
return status.New(codes.NotFound, e.Error())
143151
}
@@ -149,6 +157,7 @@ func (e *MissingPortProtocolError) Error() string {
149157
return tr("Missing port protocol")
150158
}
151159

160+
// ToRPCStatus convertes the error into a *status.Status
152161
func (e *MissingPortProtocolError) ToRPCStatus() *status.Status {
153162
return status.New(codes.InvalidArgument, e.Error())
154163
}
@@ -160,6 +169,7 @@ func (e *MissingProgrammerError) Error() string {
160169
return tr("Missing programmer")
161170
}
162171

172+
// ToRPCStatus convertes the error into a *status.Status
163173
func (e *MissingProgrammerError) ToRPCStatus() *status.Status {
164174
return status.New(codes.InvalidArgument, e.Error())
165175
}
@@ -171,6 +181,7 @@ func (e *ProgreammerRequiredForUploadError) Error() string {
171181
return tr("A programmer is required to upload")
172182
}
173183

184+
// ToRPCStatus convertes the error into a *status.Status
174185
func (e *ProgreammerRequiredForUploadError) ToRPCStatus() *status.Status {
175186
st, _ := status.
176187
New(codes.InvalidArgument, e.Error()).
@@ -192,6 +203,7 @@ func (e *ProgrammerNotFoundError) Unwrap() error {
192203
return e.Cause
193204
}
194205

206+
// ToRPCStatus convertes the error into a *status.Status
195207
func (e *ProgrammerNotFoundError) ToRPCStatus() *status.Status {
196208
return status.New(codes.NotFound, e.Error())
197209
}
@@ -206,6 +218,7 @@ func (e *InvalidPlatformPropertyError) Error() string {
206218
return tr("Invalid '%[1]s' property: %[2]s", e.Property, e.Value)
207219
}
208220

221+
// ToRPCStatus convertes the error into a *status.Status
209222
func (e *InvalidPlatformPropertyError) ToRPCStatus() *status.Status {
210223
return status.New(codes.FailedPrecondition, e.Error())
211224
}
@@ -219,6 +232,7 @@ func (e *MissingPlatformPropertyError) Error() string {
219232
return tr("Property '%s' is undefined", e.Property)
220233
}
221234

235+
// ToRPCStatus convertes the error into a *status.Status
222236
func (e *MissingPlatformPropertyError) ToRPCStatus() *status.Status {
223237
return status.New(codes.FailedPrecondition, e.Error())
224238
}
@@ -233,6 +247,7 @@ func (e *PlatformNotFound) Error() string {
233247
return composeErrorMsg(tr("Platform '%s' not found", e.Platform), e.Cause)
234248
}
235249

250+
// ToRPCStatus convertes the error into a *status.Status
236251
func (e *PlatformNotFound) ToRPCStatus() *status.Status {
237252
return status.New(codes.FailedPrecondition, e.Error())
238253
}
@@ -251,6 +266,7 @@ func (e *LibraryNotFound) Error() string {
251266
return composeErrorMsg(tr("Library '%s' not found", e.Library), e.Cause)
252267
}
253268

269+
// ToRPCStatus convertes the error into a *status.Status
254270
func (e *LibraryNotFound) ToRPCStatus() *status.Status {
255271
return status.New(codes.FailedPrecondition, e.Error())
256272
}
@@ -269,6 +285,7 @@ func (e *LibraryDependenciesResolutionFailedError) Error() string {
269285
return composeErrorMsg(tr("No valid dependencies solution found"), e.Cause)
270286
}
271287

288+
// ToRPCStatus convertes the error into a *status.Status
272289
func (e *LibraryDependenciesResolutionFailedError) ToRPCStatus() *status.Status {
273290
return status.New(codes.FailedPrecondition, e.Error())
274291
}
@@ -286,6 +303,7 @@ func (e *PlatformAlreadyAtTheLatestVersionError) Error() string {
286303
return tr("Platform '%s' is already at the latest version", e.Platform)
287304
}
288305

306+
// ToRPCStatus convertes the error into a *status.Status
289307
func (e *PlatformAlreadyAtTheLatestVersionError) ToRPCStatus() *status.Status {
290308
st, _ := status.
291309
New(codes.AlreadyExists, e.Error()).
@@ -300,6 +318,7 @@ func (e *MissingSketchPathError) Error() string {
300318
return tr("Missing sketch path")
301319
}
302320

321+
// ToRPCStatus convertes the error into a *status.Status
303322
func (e *MissingSketchPathError) ToRPCStatus() *status.Status {
304323
return status.New(codes.InvalidArgument, e.Error())
305324
}
@@ -317,6 +336,7 @@ func (e *CantOpenSketchError) Unwrap() error {
317336
return e.Cause
318337
}
319338

339+
// ToRPCStatus convertes the error into a *status.Status
320340
func (e *CantOpenSketchError) ToRPCStatus() *status.Status {
321341
return status.New(codes.NotFound, e.Error())
322342
}
@@ -335,6 +355,7 @@ func (e *FailedInstallError) Unwrap() error {
335355
return e.Cause
336356
}
337357

358+
// ToRPCStatus convertes the error into a *status.Status
338359
func (e *FailedInstallError) ToRPCStatus() *status.Status {
339360
return status.New(codes.Internal, e.Error())
340361
}
@@ -352,6 +373,7 @@ func (e *FailedLibraryInstallError) Unwrap() error {
352373
return e.Cause
353374
}
354375

376+
// ToRPCStatus convertes the error into a *status.Status
355377
func (e *FailedLibraryInstallError) ToRPCStatus() *status.Status {
356378
return status.New(codes.Internal, e.Error())
357379
}
@@ -370,6 +392,7 @@ func (e *FailedUninstallError) Unwrap() error {
370392
return e.Cause
371393
}
372394

395+
// ToRPCStatus convertes the error into a *status.Status
373396
func (e *FailedUninstallError) ToRPCStatus() *status.Status {
374397
return status.New(codes.Internal, e.Error())
375398
}
@@ -388,6 +411,7 @@ func (e *FailedDownloadError) Unwrap() error {
388411
return e.Cause
389412
}
390413

414+
// ToRPCStatus convertes the error into a *status.Status
391415
func (e *FailedDownloadError) ToRPCStatus() *status.Status {
392416
return status.New(codes.Internal, e.Error())
393417
}
@@ -406,6 +430,7 @@ func (e *FailedUploadError) Unwrap() error {
406430
return e.Cause
407431
}
408432

433+
// ToRPCStatus convertes the error into a *status.Status
409434
func (e *FailedUploadError) ToRPCStatus() *status.Status {
410435
return status.New(codes.Internal, e.Error())
411436
}
@@ -424,6 +449,7 @@ func (e *FailedDebugError) Unwrap() error {
424449
return e.Cause
425450
}
426451

452+
// ToRPCStatus convertes the error into a *status.Status
427453
func (e *FailedDebugError) ToRPCStatus() *status.Status {
428454
return status.New(codes.Internal, e.Error())
429455
}
@@ -442,6 +468,7 @@ func (e *CompileFailedError) Unwrap() error {
442468
return e.Cause
443469
}
444470

471+
// ToRPCStatus convertes the error into a *status.Status
445472
func (e *CompileFailedError) ToRPCStatus() *status.Status {
446473
return status.New(codes.Internal, e.Error())
447474
}
@@ -460,6 +487,7 @@ func (e *InvalidArgumentError) Unwrap() error {
460487
return e.Cause
461488
}
462489

490+
// ToRPCStatus convertes the error into a *status.Status
463491
func (e *InvalidArgumentError) ToRPCStatus() *status.Status {
464492
return status.New(codes.InvalidArgument, e.Error())
465493
}
@@ -478,6 +506,7 @@ func (e *NotFoundError) Unwrap() error {
478506
return e.Cause
479507
}
480508

509+
// ToRPCStatus convertes the error into a *status.Status
481510
func (e *NotFoundError) ToRPCStatus() *status.Status {
482511
return status.New(codes.NotFound, e.Error())
483512
}
@@ -496,6 +525,7 @@ func (e *PermissionDeniedError) Unwrap() error {
496525
return e.Cause
497526
}
498527

528+
// ToRPCStatus convertes the error into a *status.Status
499529
func (e *PermissionDeniedError) ToRPCStatus() *status.Status {
500530
return status.New(codes.PermissionDenied, e.Error())
501531
}
@@ -514,6 +544,7 @@ func (e *UnavailableError) Unwrap() error {
514544
return e.Cause
515545
}
516546

547+
// ToRPCStatus convertes the error into a *status.Status
517548
func (e *UnavailableError) ToRPCStatus() *status.Status {
518549
return status.New(codes.Unavailable, e.Error())
519550
}
@@ -531,6 +562,7 @@ func (e *TempDirCreationFailedError) Unwrap() error {
531562
return e.Cause
532563
}
533564

565+
// ToRPCStatus convertes the error into a *status.Status
534566
func (e *TempDirCreationFailedError) ToRPCStatus() *status.Status {
535567
return status.New(codes.Unavailable, e.Error())
536568
}
@@ -548,6 +580,7 @@ func (e *TempFileCreationFailedError) Unwrap() error {
548580
return e.Cause
549581
}
550582

583+
// ToRPCStatus convertes the error into a *status.Status
551584
func (e *TempFileCreationFailedError) ToRPCStatus() *status.Status {
552585
return status.New(codes.Unavailable, e.Error())
553586
}
@@ -566,6 +599,7 @@ func (e *SignatureVerificationFailedError) Unwrap() error {
566599
return e.Cause
567600
}
568601

602+
// ToRPCStatus convertes the error into a *status.Status
569603
func (e *SignatureVerificationFailedError) ToRPCStatus() *status.Status {
570604
return status.New(codes.Unavailable, e.Error())
571605
}

0 commit comments

Comments
 (0)