microsoftgraph / microsoftgraph/msgraph-beta-sdk-php

ODataError::__toString() does not provide useful informations

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

Nobody has claimed this yet.

ToTriage type:enhancement
Dominant language
PHP
Stars
13
Forks
8
Avg merge
14h 58m
Merged PRs (30d)
3

Description

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_

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.