Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add error codes to exceptions #1036

Merged
merged 3 commits into from
Dec 4, 2023
Merged

feat: add error codes to exceptions #1036

merged 3 commits into from
Dec 4, 2023

Conversation

braindigitalis
Copy link
Contributor

@braindigitalis braindigitalis commented Dec 4, 2023

This lets users check what type of exception by exception.code() instead of having to rely on string comparison of exception.what(). This is a non-breaking change as the previous functionality still exists alongside the old style constructors for anyone who is directly instantiating their own dpp exceptions in their bot (not sure why they would be, though).

Note the huge enum exception_error_code in exception.h. This will need to be maintained periodically by us as Discord add new errors. It can also be used with get_error() of a callback and matched against get_error().code.

Code change checklist

  • I have ensured that all methods and functions are fully documented using doxygen style comments.
  • My code follows the coding style guide.
  • I tested that my change works before raising the PR.
  • I have ensured that I did not break any existing API calls.
  • I have not built my pull request using AI, a static analysis tool or similar without any human oversight.

Copy link

netlify bot commented Dec 4, 2023

Deploy Preview for dpp-dev ready!

Name Link
🔨 Latest commit b046480
🔍 Latest deploy log https://app.netlify.com/sites/dpp-dev/deploys/656dc27e085173000808e7c1
😎 Deploy Preview https://deploy-preview-1036--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.

@braindigitalis braindigitalis self-assigned this Dec 4, 2023
@github-actions github-actions bot added documentation Improvements or additions to documentation code Improvements or additions to code. labels Dec 4, 2023
include/dpp/exception.h Outdated Show resolved Hide resolved
include/dpp/exception.h Outdated Show resolved Hide resolved
include/dpp/sync.h Outdated Show resolved Hide resolved
@braindigitalis braindigitalis merged commit 20a026a into dev Dec 4, 2023
66 checks passed
@Jaskowicz1 Jaskowicz1 deleted the error_code branch April 4, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Improvements or additions to code. documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants