You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Logger.Error(@"Error pulsing, response does not contain ""ok"" or ""success"": "+JsonResult);
467
490
}
468
491
}
469
-
catch(WebExceptionex)
492
+
catch(TaskCanceledException)
493
+
{
494
+
pulseQueue.Enqueue(result);// requeue current pulse
495
+
return;
496
+
}
497
+
catch(HttpRequestExceptionex)
470
498
{
471
499
error=true;
472
-
if(ex.Status==WebExceptionStatus.ProtocolError)
500
+
if(response!=null&&response.StatusCode!=0)
473
501
{
474
-
varresponse=ex.ResponseasHttpWebResponse;
475
-
if(response!=null)
502
+
if((int)response.StatusCode==403)
476
503
{
477
-
if((int)response.StatusCode==403)
478
-
{
479
-
Logger.Error("Could not pulse (error 403). Please make sure you entered a valid API token in Code::Stats settings.",ex);
480
-
if(!_hasAlreadyShownInvalidApiTokenMessage)// we want to inform user only once, and if they do not provide the token, let's not bomb him with error each time after they type something
481
-
{
482
-
_hasAlreadyShownInvalidApiTokenMessage=true;
483
-
MessageBox.Show("Could not pulse. Please make sure you entered a valid API token in Code::Stats settings.\nAll recorded XP from this session will be lost if you do not provide the correct API token!","Code::Stats – error 403",MessageBoxButtons.OK,MessageBoxIcon.Error);
Logger.Error("Could not pulse (error 403). Please make sure you entered a valid API token in Code::Stats settings.",ex);
505
+
if(!_hasAlreadyShownInvalidApiTokenMessage)// we want to inform user only once, and if they do not provide the token, let's not bomb him with error each time after they type something
488
506
{
489
-
Logger.Error("Could not pulse (error 404). The entered custom endpoint ("+URL+") is invalid. ",ex);
490
-
MessageBox.Show("Could not pulse. Invalid API endpoint URL. Please make sure you entered a valid API URL in Code::Stats settings or delete the value altogether to restore the default.\nAll recorded XP from this session will be lost if you do not provide the correct API URL path!","Code::Stats – error 404",MessageBoxButtons.OK,MessageBoxIcon.Error);
491
-
492
-
//_settingsForm.txtAPIURL.Focus();
493
-
//_settingsForm.txtAPIURL.SelectAll();
494
-
_settingsForm.FocusTxtAPIURL();
495
-
_settingsForm.ShowAPIURLTooltip();
496
-
SettingsPopup();
497
-
_settingsForm.ShowAPIURLTooltip();
498
-
}
499
-
else
500
-
{
501
-
Logger.Error("Could not pulse - HTTP error "+(int)response.StatusCode+". Server response: "+response.GetResponseStream().ToString(),ex);
507
+
_hasAlreadyShownInvalidApiTokenMessage=true;
508
+
MessageBox.Show("Could not pulse. Please make sure you entered a valid API token in Code::Stats settings.\nAll recorded XP from this session will be lost if you do not provide the correct API token!","Code::Stats – error 403",MessageBoxButtons.OK,MessageBoxIcon.Error);
Logger.Error("Could not pulse (error 404). The entered custom endpoint ("+URL+") is invalid. ",ex);
515
+
MessageBox.Show("Could not pulse. Invalid API endpoint URL. Please make sure you entered a valid API URL in Code::Stats settings or delete the value altogether to restore the default.\nAll recorded XP from this session will be lost if you do not provide the correct API URL path!","Code::Stats – error 404",MessageBoxButtons.OK,MessageBoxIcon.Error);
516
+
517
+
_settingsForm.FocusTxtAPIURL();
518
+
_settingsForm.ShowAPIURLTooltip();
519
+
SettingsPopup();
520
+
_settingsForm.ShowAPIURLTooltip();
521
+
}
504
522
else
505
523
{
506
-
// response==null - no http status code available
507
-
Logger.Error("Could not pulse. Are you behind a proxy? Try setting a proxy in Code::Stats settings with format https://user:pass@host:port. Exception Traceback",ex);
524
+
Logger.Error("Could not pulse - HTTP error "+(int)response.StatusCode+". Server response: "+response.Content.ReadAsStringAsync().Result,ex);
508
525
}
509
526
}
510
-
elseLogger.Error("Could not pulse. Are you behind a proxy? Try setting a proxy in Code::Stats settings with format https://user:pass@host:port. Exception Traceback",ex);
527
+
else
528
+
{
529
+
// response==null - no http status code available
530
+
Logger.Error("Could not pulse. Are you behind a proxy? Try setting a proxy in Code::Stats settings with format https://user:pass@host:port. Exception Traceback",ex);
0 commit comments