Reject promise when deploy to board fails (#267)
* Reject promise when deploy to board fails * Change var to let
This commit is contained in:
parent
a34f765681
commit
5e9eec61c5
@ -13,10 +13,13 @@ export function deployCoreAsync(res: ts.pxtc.CompileResult) {
|
|||||||
return getBitDrivesAsync()
|
return getBitDrivesAsync()
|
||||||
.then(drives => {
|
.then(drives => {
|
||||||
if (drives.length == 0) {
|
if (drives.length == 0) {
|
||||||
console.log("cannot find any drives to deploy to")
|
let msg = "cannot find any drives to deploy to";
|
||||||
} else {
|
console.log(msg);
|
||||||
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "))
|
return Promise.reject(new Error(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "))
|
||||||
|
|
||||||
return Promise.map(drives, d =>
|
return Promise.map(drives, d =>
|
||||||
writeFileAsync(d + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
writeFileAsync(d + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user