Changeset 1409
- Timestamp:
- 12/22/2009 10:38:31 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/BlackBox/Eraser/BlackBoxUploadForm.cs
r1408 r1409 103 103 private void UploadWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) 104 104 { 105 if (e.Error != null) 106 MessageBox.Show(e.Error.Message); 107 ProgressLbl.Text = S._("Reports submitted successfully."); 108 CancelBtn.Text = S._("Close"); 105 if (e.Error == null) 106 { 107 ProgressLbl.Text = S._("Reports submitted successfully."); 108 CancelBtn.Text = S._("Close"); 109 } 110 else 111 { 112 MessageBox.Show(this, e.Error.Message, 113 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error, 114 MessageBoxDefaultButton.Button1, S.IsRightToLeft(this) ? 115 MessageBoxOptions.RtlReading : 0); 116 Close(); 117 } 109 118 } 110 119 … … 160 169 } 161 170 162 HttpWebResponse response = reportRequest.GetResponse() as HttpWebResponse;163 if (response.StatusCode != HttpStatusCode.OK)164 {171 try 172 { 173 HttpWebResponse response = reportRequest.GetResponse() as HttpWebResponse; 165 174 using (Stream responseStream = response.GetResponseStream()) 175 { 176 XmlReader reader = XmlReader.Create(responseStream); 177 reader.ReadToFollowing("crashReport"); 178 string reportStatus = reader.GetAttribute("status"); 179 switch (reportStatus) 180 { 181 case "exists": 182 return false; 183 184 case "new": 185 return true; 186 187 default: 188 throw new InvalidDataException(S._("Unknown crash report server response.")); 189 } 190 } 191 } 192 catch (WebException e) 193 { 194 using (Stream responseStream = e.Response.GetResponseStream()) 166 195 { 167 196 try … … 177 206 } 178 207 179 throw new InvalidDataException(response.StatusDescription); 180 } 181 182 using (Stream responseStream = response.GetResponseStream()) 183 { 184 XmlReader reader = XmlReader.Create(responseStream); 185 reader.ReadToFollowing("crashReport"); 186 string reportStatus = reader.GetAttribute("status"); 187 switch (reportStatus) 188 { 189 case "exists": 190 return false; 191 192 case "new": 193 return true; 194 195 default: 196 throw new InvalidDataException(S._("Unknown crash report server response.")); 197 } 208 throw new InvalidDataException(((HttpWebResponse)e.Response).StatusDescription); 198 209 } 199 210 } … … 265 276 } 266 277 267 HttpWebResponse response = reportRequest.GetResponse() as HttpWebResponse; 268 if (response.StatusCode != HttpStatusCode.OK) 269 { 270 using (Stream responseStream = response.GetResponseStream()) 278 try 279 { 280 reportRequest.GetResponse(); 281 } 282 catch (WebException e) 283 { 284 using (Stream responseStream = e.Response.GetResponseStream()) 271 285 { 272 286 try … … 282 296 } 283 297 284 throw new InvalidDataException( response.StatusDescription);298 throw new InvalidDataException(((HttpWebResponse)e.Response).StatusDescription); 285 299 } 286 300 }
Note: See TracChangeset
for help on using the changeset viewer.
