Background
As of tapas-xq PR #31, several endpoints that previously returned 500 for a missing document now correctly return HTTP 404 instead. This affects:
POST /:project-id/:doc-id/mods — store MODS (doc must exist first)
POST /:project-id/:doc-id/tfe — store TFE (doc must exist first)
DELETE /:project-id/:doc-id — delete core file
DELETE /:project-id — delete project documents
Problem
TapasXq::Client#get already rescues RestClient::NotFound and raises TapasXq::NotFoundError. However, #post and #delete do not rescue 404. A 404 from either method falls through to handle_error_response, which raises the generic:
TapasXq::InvalidResponseError: "Unexpected status code: 404"
This means callers cannot distinguish "document not found" from other unexpected errors, and the processing_error stored on CoreFile is unhelpfully generic.
Suggested fix
app/services/tapas_xq/client.rb — add 404 rescue to #post and #delete:
rescue RestClient::NotFound
raise TapasXq::NotFoundError, "Resource not found"
This is already the pattern used in #get.
References
Background
As of tapas-xq PR #31, several endpoints that previously returned 500 for a missing document now correctly return HTTP 404 instead. This affects:
POST /:project-id/:doc-id/mods— store MODS (doc must exist first)POST /:project-id/:doc-id/tfe— store TFE (doc must exist first)DELETE /:project-id/:doc-id— delete core fileDELETE /:project-id— delete project documentsProblem
TapasXq::Client#getalready rescuesRestClient::NotFoundand raisesTapasXq::NotFoundError. However,#postand#deletedo not rescue 404. A 404 from either method falls through tohandle_error_response, which raises the generic:This means callers cannot distinguish "document not found" from other unexpected errors, and the
processing_errorstored onCoreFileis unhelpfully generic.Suggested fix
app/services/tapas_xq/client.rb— add 404 rescue to#postand#delete:This is already the pattern used in
#get.References
app/services/tapas_xq/client.rb