Skip to content

Fix Typo & Type Error in LavalinkException#352

Open
Jiggly-Balls wants to merge 5 commits into
PythonistaGuild:mainfrom
Jiggly-Balls:typo/lavalink-exception
Open

Fix Typo & Type Error in LavalinkException#352
Jiggly-Balls wants to merge 5 commits into
PythonistaGuild:mainfrom
Jiggly-Balls:typo/lavalink-exception

Conversation

@Jiggly-Balls

@Jiggly-Balls Jiggly-Balls commented Jun 23, 2026

Copy link
Copy Markdown

Description

This PR fixes a typo in the docs of wavelink.exception.LavalinkException class, where it mentions the attribute reason to hold the reason of the exception but it's the error attribute that holds the reason.

I've decided to only change to documentation name to match the attribute name instead of matching the attribute name to the mentioned name in the doc, to prevent any backward incompatibility.

The only thing I'm not fully sure of is the additional type annotation "fix" I made, the docs mention that the reason (error attr) can be None but the ErrorResponse typed dict & the error attribute in the LavalinkException class don't annotate it as None | str. So either I'm correct about the fix or the documentation is wrong about reason (error) being None | str.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
    • I have updated the changelog with a quick recap of my changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
  • I have read and agree to the Developer Certificate of Origin for this contribution

P.S. There doesn't seem to be a changelog file in this repo... unless I'm terribly blind.

@chillymosh chillymosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have examples where this attribute has returned None instead of an HTTP status code message?

Comment thread wavelink/types/response.py Outdated
Comment thread wavelink/exceptions.py Outdated
@Jiggly-Balls

Jiggly-Balls commented Jul 7, 2026

Copy link
Copy Markdown
Author

Do you have examples where this attribute has returned None instead of an HTTP Status Code?

It's the HTTP Status Code? I thought it returned a reason description of the error. I'm not 100% sure if it can be None either way though, I just thought that you may have misnamed that attribute in the docs, so I used the type hint of the old attribute (reason) everywhere in the code.

@chillymosh

Copy link
Copy Markdown
Contributor

Do you have examples where this attribute has returned None instead of an HTTP Status Code?

It's the HTTP Status Code? I thought it returned a reason description of the error. I'm not 100% sure if it can be None either way though, I just thought that you may have misnamed that attribute in the docs and used the type hint of the old attribute (reason) everywhere in the code.

It's the HTTP status code message.
I am all for correcting it to error, from reason. But unless there are examples of it returning None, then the annotations should not be changed. If you went solely from the existing description then that could have been wrong the whole time, or from a change LL made.

There is a message attribute, which looks to be missing, that would contain the true error message.

I recommend checking the Lavalink docs.

Otherwise simply correcting the attribute in the docs is fine for now, since we will be releasing v4 soon.

@Jiggly-Balls

Copy link
Copy Markdown
Author

Right, doesn't seem like it can be None. https://lavalink.dev/api/rest.html#error-responses

In that case I'll just fix the annotations? Or do you also want me to add the message attribute to it?

@Jiggly-Balls

Jiggly-Balls commented Jul 7, 2026

Copy link
Copy Markdown
Author

Now that I take a look at it again, the trace and path & timestamp attributes are present in the class but haven't been added to the docs though.

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.

2 participants