alphagov / manuals-publisher

Publishes manuals on GOV.UK
https://docs.publishing.service.gov.uk/apps/manuals-publisher.html
MIT License
7 stars 16 forks source link

Exception when "withdrawing" a published section #1129

Open chrisroos opened 7 years ago

chrisroos commented 7 years ago

Steps to reproduce:

  1. Create a new manual
  2. Add a section to the manual
  3. Publish the manual
  4. Visit the section, click "Withdraw" and confirm the withdrawal
  5. Observe that a RestClient::UnprocessableEntity: 422 Unprocessable Entity exception is raised from the Publishing API

Despite this exception being raised by the Publishing API the Section will have been deleted from the local manuals-publisher database. This means that it you go "back" in the browser and try to withdraw the section again you'll now see the Section::RemoveService::SectionNotFoundError exception. At this point the local database and Publishing API/Content Store are out of sync.

chrisroos commented 7 years ago

We've recently seen the Section::RemoveService::SectionNotFoundError in production.

My guess is that the user encountered a Publishing API error and then used the browser back button to try again. By which time the Section stored in the local database had been removed.