Skip to content

[BUG] message and code are swapped in LibraryException #896

@Toricane

Description

@Toricane

Describe the bug.

in LibraryException this is the __init__:

def __init__(self, message: str = None, code: int = 0, severity: int = 0, **kwargs):

however, the library uses errors like:

raise LibraryException(11, message="Your command must have a name.")

which when tried in a terminal results in

>>> raise LibraryException(11, message="Your command must have a name.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'message'

so the __init__ should instead be

def __init__(self, code: int = 0, message: str = None, severity: int = 0, **kwargs):

List the steps.

>>> from interactions import LibraryException 
>>> raise LibraryException(11, message="Your command must have a name.") 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'message'

What you expected.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
interactions.api.error.LibraryException: An error occurred:
Your command must have a name., with code '11' and severity '0'

What you saw.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'message'

What version of the library did you use?

unstable

Version specification

No response

Code of Conduct

  • I agree to follow the contribution requirements.

Metadata

Metadata

Labels

breakingThis contains breaking changesbugSomething isn't workinghelp wantedExtra attention is neededpriorityThis Issue/PR must be resolved first before accepting any others

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions