Fix CSR exchange exception disappearing in the void

Summary: I accidentally wrote a cert at the wrong location, but noticed that there was never raised an exception. Added error handing to surface the error. Seems the underlying RSocket implementation silently eats errors that escape from handlers....

Reviewed By: lblasa

Differential Revision: D31015168

fbshipit-source-id: 38480921c3cf33f3a5d91eb2ed4e3a912fdf74a7
This commit is contained in:
Michel Weststrate
2021-09-17 05:00:48 -07:00
committed by Facebook GitHub Bot
parent 41286ce4b8
commit 5739e0c943

View File

@@ -163,20 +163,29 @@ abstract class ServerAdapter {
console.log(
`[conn] Starting certificate exchange: ${clientQuery.app} on ${clientQuery.device}`,
);
const result = await this.listener.onProcessCSR(
csr,
clientQuery,
destination,
transformCertificateExchangeMediumToType(medium),
);
try {
const result = await this.listener.onProcessCSR(
csr,
clientQuery,
destination,
transformCertificateExchangeMediumToType(medium),
);
console.log(
`[conn] Exchanged certificate: ${clientQuery.app} on ${result.deviceId}`,
);
const response = JSON.stringify({
deviceId: result.deviceId,
});
return response;
console.log(
`[conn] Exchanged certificate: ${clientQuery.app} on ${result.deviceId}`,
);
const response = JSON.stringify({
deviceId: result.deviceId,
});
return response;
} catch (e) {
console.error(
`[conn] Failed to exchange certificate with ${clientQuery.app} on ${
clientQuery.device || clientQuery.device_id
}`,
e,
);
}
}
return undefined;