Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Gracefully handle AJAX failures #161

Merged

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Jan 10, 2024

Issue #110

I tested by adding the following in to controller endpoints on LinkFieldController:

  • $this->jsonError(500, 'FFF'); - expected failure
  • throw new Exception('AAA'); - unexpected failure
  • set_time_limit(1);while(true); - simulate timeout

I tested when:

  • Reading links LinkFieldController::getLinkData()
  • Deleting links LinkFieldController::linkDelete()
  • Saving links LinkFieldController::save()

@GuySartorelli
Copy link
Member

There are conflicts to resolve.

@emteknetnz
Copy link
Member Author

Conflicts resolved

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

In a perfect world we'd add some JEST tests for this but I'm not too bothered about it, the main thing IMO is that the data doesn't end up in a bad state which it looks like it would be pretty hard to accomplish via thrown exceptions etc.

@GuySartorelli GuySartorelli merged commit bfc5eb3 into silverstripe:4 Jan 10, 2024
10 checks passed
@GuySartorelli GuySartorelli deleted the pulls/4/ajax-errors branch January 10, 2024 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants