Composer: Properly handle cases where `composer.json` is missing or malformed
Summary
When publishing a composer package, the composer.json
file can:
- be missing
- the backend may be unable to parse it.
In both cases, the request will end up in a RuntimeError
.
Steps to reproduce
- Publish a composer package where the
composer.json
file is missing or malformed.
What is the current bug behavior?
- The API request will end up with a
RuntimeError
. Our guess is that the backend will reply a 500 response.
What is the expected correct behavior?
- It would better if the API answers
400 Bad Request
, meaning that the backend understood the request but given the parameters, it can't fulfill it.
Possible fixes
- Catch the possible errors here and answer a
bad_request!
Edited by David Fernandez