Skip to content

Commit 175f09c

Browse files
committed
fix error message for Unsupported characters
1 parent 084bccf commit 175f09c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libraries/keyboard_layout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def _above128char_to_keycode(self, char):
111111
return self.HIGHER_ASCII[ord(char)]
112112

113113
raise ValueError(
114-
"Unsupported non-ASCII character {} \\x{}."
115-
.format(str(char), ord(char))
114+
"Unsupported non-ASCII character {letter} ({num}/0x{num:02x})."
115+
.format(letter=str(char), num=ord(char))
116116
)
117117

118118
def _char_to_keycode(self, char):
@@ -127,7 +127,7 @@ def _char_to_keycode(self, char):
127127
keycode = self.ASCII_TO_KEYCODE[char_val]
128128
if keycode == 0:
129129
raise ValueError(
130-
"No keycode available for character {} \\x{}."
131-
.format(str(char), char_val)
130+
"No keycode available for character {letter} ({num}/0x{num:02x})."
131+
.format(letter=str(char), num=char_val)
132132
)
133133
return keycode

0 commit comments

Comments
 (0)