Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Apr 24, 2022
1 parent c59f293 commit e8279e7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/pingSerialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function deserializePing(pingSerialized: Buffer): Ping {
try {
pda = deserializeCertificate(pingJson.pda);
} catch (err) {
throw new PingSerializationError(err, 'Invalid PDA');
throw new PingSerializationError(err as Error, 'Invalid PDA');
}

if (!Array.isArray(pingJson.pda_chain)) {
Expand All @@ -54,7 +54,7 @@ export function deserializePing(pingSerialized: Buffer): Ping {
try {
pdaChain = pingJson.pda_chain.map(deserializeCertificate);
} catch (err) {
throw new PingSerializationError(err, 'PDA chain contains invalid item');
throw new PingSerializationError(err as Error, 'PDA chain contains invalid item');
}

return { id: pingJson.id, pda, pdaChain };
Expand All @@ -72,8 +72,11 @@ function deserializeCertificate(certificateDerBase64: any): Certificate {

try {
return Certificate.deserialize(bufferToArray(certificateDer));
} catch (error) {
throw new PingSerializationError(error, 'Certificate is base64-encoded but not DER-encoded');
} catch (err) {
throw new PingSerializationError(
err as Error,
'Certificate is base64-encoded but not DER-encoded',
);
}
}

Expand Down

0 comments on commit e8279e7

Please sign in to comment.