More specific idb failure logging

Summary: The "Conflict in temp dir" message was misleading when there were 0, rather than >1 file. This fixes that error message.

Reviewed By: passy

Differential Revision: D15716247

fbshipit-source-id: 572addf99f623cdcffd7602dd3935bb69a50d047
This commit is contained in:
John Knox
2019-06-10 04:10:02 -07:00
committed by Facebook Github Bot
parent 10211e4fa1
commit 3fcd9c8e51

View File

@@ -362,9 +362,12 @@ export default class CertificateProvider {
.then(dir => {
return promisify(fs.readdir)(dir)
.then(items => {
if (items.length !== 1) {
if (items.length > 1) {
throw new Error('Conflict in temp dir');
}
if (items.length === 0) {
throw new Error('Failed to pull CSR from device');
}
return items[0];
})
.then(fileName => {