fix(jsonapi): handle missing attributes in ErrorNormalizer
Fixes undefined array key warning when normalizing exceptions that don't have attributes in their normalized structure.
This typically occurs with ItemNotFoundException when invalid resource identifiers are provided.
| Q | A |
|---|---|
| Branch? | 4.2 |
| Tickets | not applicable |
| License | MIT |
| Doc PR | not applicable |
Description
Fixes an undefined array key warning in ErrorNormalizer when normalizing exceptions that don't have an attributes key in their normalized structure.
Problem
When ItemNotFoundException or similar exceptions are thrown for invalid resource identifiers, the ErrorNormalizer::normalize() method assumes that $jsonApiObject['data']['attributes'] exists, causing a warning.
Solution
Added defensive checks to handle cases where the attributes key is not present, providing a fallback error structure that conforms to the JSON:API specification.