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

Include the executed route in RestApiException #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

QuantumToasted
Copy link
Contributor

@QuantumToasted QuantumToasted commented Nov 7, 2024

Description

At the present moment, due to inlining hiding the method calling InternalExecuteAsync from the stack trace, it is difficult to discern at a glance which REST API route was responsible for generating a RestApiException. This PR exposes an IFormattedRoute property on RestApiException, granting bot developers more access to finding the route cause of an API exception on their end.

To note, while IFormattedRoute is the type I chose to include for more granular control, only the IFormattableRoute is exposed when it comes to generating the exception message, to avoid exposing potentially sensitive information in logs:

Failed to execute route Patch|channels/{0:channel_id}.

The route is formatted identically to how the verbose/debug logs format for rate-limit buckets are formatted. I originally formatted it as PATCH channels/{0:channel_id}, as I think it looks better, but for consistency I chose to keep it the same.

Checklist

  • I discussed this PR with the maintainer(s) prior to opening it.
  • I read the contributing guidelines.
  • I tested the changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant