ODataError::__toString() does not provide useful informations

Open
#309 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
php
Domain
api

Research direction

Start at the ODataError exception and its getError entry point, then reproduce the logged __toString() output described in the issue. Done means the serialization includes the MainError's code, message, and details in addition to the existing exception information.

Written by the indexing model from the issue text.

Description

ToTriage type:enhancement
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_
Dominant language
PHP
Stars
13
Forks
8
Avg merge
14h 58m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoftgraph/msgraph-beta-sdk-php

All issues in microsoftgraph/msgraph-beta-sdk-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.