Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Add more context in the error message #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/other/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function string_to_bytes(str: string, utf8: boolean = false): Uint8Array
if (++i >= len) throw new Error('Malformed string, low surrogate expected at position ' + i);
c = ((c ^ 0xd800) << 10) | 0x10000 | (str.charCodeAt(i) ^ 0xdc00);
} else if (!utf8 && c >>> 8) {
throw new Error('Wide characters are not allowed.');
throw new Error('Wide characters are not allowed. At the position ' + i + ' this character was found: ' + str[i])
}

if (!utf8 || c <= 0x7f) {
Expand Down