Skip to content

Commit

Permalink
Fix the error message of KeyAlreadyPresent
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming committed Apr 16, 2022
1 parent 760c34a commit dbce05c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- Use the plain python string representation of `Key` in `KeyAlreadyPresent` error message. ([#185](https://github.com/sdispater/tomlkit/issues/185))
- Fix the `astimezone()` and `replace()` methods of datetime objects. ([#188](https://github.com/sdispater/tomlkit/issues/188))
- Add type definitions for `items()` function. ([#190](https://github.com/sdispater/tomlkit/issues/190))

Expand Down
1 change: 1 addition & 0 deletions tomlkit/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class KeyAlreadyPresent(TOMLKitError):
"""

def __init__(self, key):
key = getattr(key, "key", key)
message = f'Key "{key}" already exists.'

super().__init__(message)
Expand Down

0 comments on commit dbce05c

Please sign in to comment.