Skip to content

ODataError::__toString() does not provide useful informations #309

@AntoineMarques

Description

@AntoineMarques

Describe the bug

When an error occurs, it is correctly parsed into a ODataError, which results in an Exception being thrown.
But when i try to get infos, for example by logging, no useful infos appear.
This is because ODataError infos are contained inside its error property which isn't printed.

Expected behavior

Overwrite __toString method in ODataError so that MainError obtained with getError is part of the serialization.
It contains error code, message and details

How to reproduce

try {
// Make some silly call to api to trigger an error

} catch (ODataError $e) {
var_dump($e->__toString()); // Only includes trace, no error code, message or details
}

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToTriagetype:enhancementEnhancement request targeting an existing experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions