unity-wakatime icon indicating copy to clipboard operation
unity-wakatime copied to clipboard

Handle HTTP status codes

Open Hermesiss opened this issue 6 years ago • 3 comments

I have an editor component that actively updates while selected, causing very often heartbeats. After a few seconds System.ArgumentException: JSON parse error: Invalid value. starts to appear. Server responses with

<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>

Looks like we need to check for response type and react to errors respectively. Like with temporal timeout for 405 and consider other reactions

Alternatively, in case of 405, we can increase Plugin.HEARTBEAT_COOLDOWN

Can implement after understanding Wakatime server responses or hints from @wakatime members

Hermesiss avatar Mar 27 '19 15:03 Hermesiss

Nice catch. This plugin doesn't currently handle any network errors for sure. It would be good to have a list of known error statuses WakaTime can return. /cc @alanhamlett

vladfaust avatar Mar 27 '19 17:03 vladfaust

There's no 405 reference at dev section

Hermesiss avatar Mar 27 '19 18:03 Hermesiss

That was a bug in our server's nginx config, where 429 serving a custom static error page turns into 405 because Nginx doesn't allow custom static error pages for POST requests. It's fixed now and the correct 429 response code is returned.

alanhamlett avatar May 08 '19 21:05 alanhamlett