mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
emojiset: Promise reject calls want an error, not an event.
This improves the error message captured, from the mildly inscrutable "Non-Error promise rejection captured with keys: currentTarget, isTrusted, target, type".
This commit is contained in:
committed by
Tim Abbott
parent
75008d5f50
commit
b2c048f172
@@ -30,7 +30,12 @@ export async function select(name) {
|
||||
await new Promise((resolve, reject) => {
|
||||
const sheet = new Image();
|
||||
sheet.addEventListener("load", resolve);
|
||||
sheet.addEventListener("error", reject);
|
||||
sheet.addEventListener("error", () => {
|
||||
// Unfortunately, the "event" we get doesn't have any
|
||||
// useful information on it, as it's not the window-level
|
||||
// error handler.
|
||||
reject(new Error("Failed to load emojiset " + name + " from " + sheet.src));
|
||||
});
|
||||
sheet.src = new_emojiset.sheet;
|
||||
});
|
||||
if (current_emojiset) {
|
||||
|
||||
Reference in New Issue
Block a user