brainboxdotcc / DPP

C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
https://dpp.dev/
Apache License 2.0
1.04k stars 158 forks source link

fix: fix human_readable for good #1135

Closed Mishura4 closed 4 months ago

Mishura4 commented 4 months ago

Example:

{
  "message": "Invalid Form Body",
  "code": 50035,
  "errors": {
    "data": {
      "poll": {
        "_errors": [
          {"code": "POLL_TYPE_QUESTION_ALLOWS_TEXT_ONLY", "message": "This poll type cannot include attachments, emoji or stickers with the question"}
        ]
      }
    }
  }
}

Currently the code assumes a _errors object either at the first or second level, this one is at the third level, so it wouldn't parse. This PR fixes that and adds handling of errors without an array: Error: 50035: Invalid Form Body - data.poll: This poll type cannot include attachments, emoji or stickers with the question (POLL_TYPE_QUESTION_ALLOWS_TEXT_ONLY)

Code change checklist

netlify[bot] commented 4 months ago

Deploy Preview for dpp-dev ready!

Name Link
Latest commit dcd448fabd80966685ca16ff3dab191bbd0acd83
Latest deploy log https://app.netlify.com/sites/dpp-dev/deploys/6631a28669af8d00085e0cb9
Deploy Preview https://deploy-preview-1135--dpp-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

github-actions[bot] commented 4 months ago

Thank you for your contribution, but PRs must be raised against the dev branch. Please log your pull request against the dev branch not master. You can also retarget this pull request, then reopen it.

Mishura4 commented 4 months ago

This might cause conflicts with #1126 but only because of indentation

Mishura4 commented 4 months ago

This will now flat out just conflict with #1126