Kiln » gitkiln Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

extract out common ApiErrors type

Changeset 095fd82adc29

Parent 192fa27a9dbc

by Profile picture of User 12Benjamin Pollack <benjamin@fogcreek.com>

Changes to 2 files · Browse files at 095fd82adc29 Showing diff from parent 192fa27a9dbc Diff from another changeset...

Change 1 of 2 Show Entire File kiln/​api.go Stacked
 
14
15
16
 
 
 
17
18
19
 
72
73
74
75
 
76
77
78
 
14
15
16
17
18
19
20
21
22
 
75
76
77
 
78
79
80
81
@@ -14,6 +14,9 @@
  // Human-readable description   Description string `json:"sError"`  } + +// Represents a collection of JSON errors, as returned on API failure +type ApiErrors map[string][]ApiError    // Represents the project JSON returned from the Kiln API  type Project struct { @@ -72,7 +75,7 @@
  }   var resp []byte   if resp, err = k.apiPost("Repo/Create", params); err == nil { - var errors map[string][]ApiError + var errors ApiErrors   if err = json.Unmarshal(resp, &errors); err == nil {   if kilnErr, _ := errors["errors"]; len(kilnErr) > 0 {   err = fmt.Errorf("failed: %v\n", kilnErr[0].Description)
Change 1 of 1 Show Entire File kiln/​kiln.go Stacked
 
84
85
86
87
 
88
89
90
 
84
85
86
 
87
88
89
90
@@ -84,7 +84,7 @@
  if err != nil {   return fmt.Errorf("unable to contact Kiln: %v\n", err)   } - var errors map[string][]ApiError + var errors ApiErrors   if err = json.Unmarshal(resp, &errors); err == nil {   if err, _ := errors["errors"]; len(err) > 0 {   return fmt.Errorf("failed: %v\n", err[0].Description)