Skip to content

Commit 7c630e7

Browse files
committed
TO BE REMOVED: client_example tweaks
1 parent 3a17f7f commit 7c630e7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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)
@@ -635,12 +639,11 @@ func callUpload(client rpc.ArduinoCoreServiceClient, instance *rpc.Instance) {
635639
uplRespStream, err := client.Upload(context.Background(),
636640
&rpc.UploadRequest{
637641
Instance: instance,
638-
Fqbn: "arduino:samd:mkr1000",
642+
Fqbn: "MegaCoreX:megaavr:4809",
639643
SketchPath: filepath.Join(currDir, "hello"),
640644
Port: "/dev/ttyACM0",
641645
Verbose: true,
642646
})
643-
644647
if err != nil {
645648
log.Fatalf("Upload error: %s\n", err)
646649
}
@@ -654,6 +657,13 @@ func callUpload(client rpc.ArduinoCoreServiceClient, instance *rpc.Instance) {
654657

655658
if err != nil {
656659
log.Fatalf("Upload error: %s", err)
660+
s, _ := status.FromError(err)
661+
log.Printf(`CODE=%s`, s.Code())
662+
log.Printf(`MSG="%+v"`, s.Message())
663+
for _, d := range s.Details() {
664+
_, ok := d.(*rpc.ProgrammerIsRequiredForUploadError)
665+
log.Printf(`DETAILS=Programmer required? %v`, ok)
666+
}
657667
break
658668
}
659669

0 commit comments

Comments
 (0)