Skip to content

Improve handling of failed AJAX request responses #1754

@Oaphi

Description

@Oaphi

Currently, our handling of failed AJAX request responses is all over the place: sometimes we fail silently and log to console; sometimes we create a notification with the HTTP status code; sometimes we rely on the message the server sends in the response payload.

Even when we do rely on the message field, oftentimes the server does not actually send one. Oh, and also sometimes we rely on the error field instead.

This issue is to track our efforts for streamlining our handling of failed AJAX requests:

  • flag escalation (hardcoded);
  • user soft deletion (jQuery artifact);
  • category change (hardcoded + bare HTTP status code);
  • category post type update (hardcoded + bare HTTP status code);
  • category post type deletion (hardcoded + bare HTTP status code);
  • question closure (hardcoded + bare HTTP status code OR hardcoded + server-sent message);
  • flagging (hardcoded + server-sent message);
  • flag escalation (hardcoded);
  • flag handling (hardcoded + bare HTTP status code OR hardcoded + server-sent message);
  • post image upload (hardcoded OR server-sent error OR hardcoded + bare HTTP status code);
  • suggested edit handling (hardcoded + server-sent message);
  • tag renaming (hardcoded + bare HTTP status code);
  • user ability / role granting / revoking (hardcoded + server-sent message);
  • voting (hardcoded + server-sent message + bare HTTP status code);
  • Judaism-specific: suggesting reference (hardcoded);
  • saving user preferences (console-only);

I've already added a centralized handleJSONResponse API for error handling, we just need to connect it & align server responses with it.

Metadata

Metadata

Assignees

Labels

complexity: averageNot particularly hard, not particularly trivial.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions