chore: better errors
This commit is contained in:
parent
17dc2a031c
commit
8c7ce19838
|
@ -46,9 +46,16 @@ const Encoder = (latus) => class Encoder {
|
|||
return deflate(Packet.pack(packet));
|
||||
}
|
||||
catch (error) {
|
||||
const next = new Error(`Couldn't pack ${
|
||||
Packet.name
|
||||
}(${
|
||||
JSON.stringify(packet.data[1], null, 2)
|
||||
}): ${
|
||||
error.message
|
||||
}`);
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Couldn't pack ${Packet.name}(${JSON.stringify(packet.data[1], null, 2)})`);
|
||||
throw error;
|
||||
console.error(next);
|
||||
throw next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,9 +95,10 @@ const Decoder = (latus) => class Decoder extends decorate(class {}) {
|
|||
});
|
||||
}
|
||||
catch (error) {
|
||||
const next = new Error(`Couldn't unpack ${Packet.name}(${view}): ${error.message}`);
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Couldn't unpack ${Packet.name}(${view})`);
|
||||
throw error;
|
||||
console.error(next);
|
||||
throw next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user