NUWCDIVNPT / stig-manager

An API and client for managing STIG assessments
Other
112 stars 29 forks source link

fix: getAssetMetadataKeys now envokes NotFoundError() when asset does not have metadata. #1360

Closed Matte22 closed 3 weeks ago

Matte22 commented 3 weeks ago

This PR corrects dead logic surrounding error handling in getAssetMetadataKeys where the API would return an empty array (200) instead of an error when no metadata keys were found. It now correctly checks if the result array is empty and throws a NotFoundError.

This is just fixing what the code was attempting to do. Not sure if we WANT to return 404 anyway! We also have the pattern of getCollectionMetadata which will just return an empty object/array and a 200.

After looking further the same pattern of dead code is in getCollectionMetadataKeys and getReviewMetadataKeys.

sonarcloud[bot] commented 3 weeks ago

Quality Gate Passed Quality Gate passed for 'nuwcdivnpt_stig-manager-api'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
50.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud