Skip to content

Commit 273cffa

Browse files
committed
TO BE REMOVED: client_example tweaks
1 parent 84dddf6 commit 273cffa

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: client_example/main.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ func main() {
6666

6767
settingsClient := settings.NewSettingsServiceClient(conn)
6868

69+
callUpload(client, initInstance(client))
70+
return
6971
// Now we can call various methods of the API...
70-
72+
log.Println("calling LibraryDownload([email protected])")
73+
callLibDownload(client, initInstance(client))
74+
return
7175
// `Version` can be called without any setup or init procedure.
7276
log.Println("calling Version")
7377
callVersion(client)
@@ -623,12 +627,11 @@ func callUpload(client rpc.ArduinoCoreServiceClient, instance *rpc.Instance) {
623627
uplRespStream, err := client.Upload(context.Background(),
624628
&rpc.UploadRequest{
625629
Instance: instance,
626-
Fqbn: "arduino:samd:mkr1000",
630+
Fqbn: "MegaCoreX:megaavr:4809",
627631
SketchPath: filepath.Join(currDir, "hello"),
628632
Port: "/dev/ttyACM0",
629633
Verbose: true,
630634
})
631-
632635
if err != nil {
633636
log.Fatalf("Upload error: %s\n", err)
634637
}
@@ -642,6 +645,13 @@ func callUpload(client rpc.ArduinoCoreServiceClient, instance *rpc.Instance) {
642645

643646
if err != nil {
644647
log.Fatalf("Upload error: %s", err)
648+
s, _ := status.FromError(err)
649+
log.Printf(`CODE=%s`, s.Code())
650+
log.Printf(`MSG="%+v"`, s.Message())
651+
for _, d := range s.Details() {
652+
_, ok := d.(*rpc.ProgrammerIsRequiredForUploadError)
653+
log.Printf(`DETAILS=Programmer required? %v`, ok)
654+
}
645655
break
646656
}
647657

0 commit comments

Comments
 (0)