diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index 62f4926d430e8c2c97792f9b1498b2a420da8049..f98f1bb5dc8c2d4e6ccb9a1a72793e77f1988230 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -88,16 +88,16 @@ def api_get_from(get_path) request = Runtime::API::Request.new(api_client, path) response = get(request.url) - if response.code == HTTP_STATUS_SERVER_ERROR - raise(InternalServerError, <<~MSG.strip) - Failed to GET #{request.mask_url} - (#{response.code}): `#{response}`. - #{QA::Support::Loglinking.failure_metadata(response.headers[:x_request_id])} - MSG - elsif response.code != HTTP_STATUS_OK + if response.code == HTTP_STATUS_NOT_FOUND raise(ResourceNotFoundError, <<~MSG.strip) Resource at #{request.mask_url} could not be found (#{response.code}): `#{response}`. #{QA::Support::Loglinking.failure_metadata(response.headers[:x_request_id])} MSG + elsif !success?(response.code) + raise(InternalServerError, <<~MSG.strip) + Failed to GET #{request.mask_url} - (#{response.code}): `#{response}`. + #{QA::Support::Loglinking.failure_metadata(response.headers[:x_request_id])} + MSG end response