Improve error handling in DishWorker

Throws DishError when cptable.utils.decode fails
This commit is contained in:
Zack Zhou 2026-02-05 10:45:00 +08:00
parent 87bc4f3c82
commit 5ea1b146da

View File

@ -98,7 +98,7 @@ async function bufferToStr(data) {
try {
str = cptable.utils.decode(data.encoding, new Uint8Array(data.buffer));
} catch (err) {
str = err.message;
str = new DishError(`Error decoding buffer with encoding ${CHR_ENC_SIMPLE_REVERSE_LOOKUP[data.encoding]}: ${err.message}`).toString();
}
}