Dapjs (#1963)
* properly log exception * report more error paths * tweak dialogs * move dapjs to prepend folder * bump pxt
This commit is contained in:
parent
b0a6df8328
commit
26036e4b28
@ -3,6 +3,7 @@
|
|||||||
/// <reference path="../node_modules/pxt-core/built/pxtcompiler.d.ts" />
|
/// <reference path="../node_modules/pxt-core/built/pxtcompiler.d.ts" />
|
||||||
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
|
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
|
||||||
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts" />
|
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts" />
|
||||||
|
/// <reference path="dapjs.d.ts" />
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
const imul = (Math as any).imul;
|
const imul = (Math as any).imul;
|
||||||
@ -471,22 +472,22 @@ function flashAsync(resp: pxtc.CompileResult, d: pxt.commands.DeployOptions = {}
|
|||||||
return quickHidFlashAsync(resp, wrap);
|
return quickHidFlashAsync(resp, wrap);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
pxt.log(`flash error: ${e.type}`);
|
||||||
if (e.type === "devicenotfound" && d.reportDeviceNotFoundAsync) {
|
if (e.type === "devicenotfound" && d.reportDeviceNotFoundAsync) {
|
||||||
pxt.tickEvent("hid.flash.devicenotfound");
|
pxt.tickEvent("hid.flash.devicenotfound");
|
||||||
return d.reportDeviceNotFoundAsync("/device/windows-app/troubleshoot", resp);
|
return d.reportDeviceNotFoundAsync("/device/windows-app/troubleshoot", resp);
|
||||||
} else if (e.message === timeoutMessage) {
|
} else if (e.message === timeoutMessage) {
|
||||||
pxt.tickEvent("hid.flash.timeout");
|
pxt.tickEvent("hid.flash.timeout");
|
||||||
return previousDapWrapper.reconnectAsync(true)
|
return previousDapWrapper.reconnectAsync(true)
|
||||||
.catch((e) => {
|
.catch((e) => { })
|
||||||
|
.then(() => {
|
||||||
// Best effort disconnect; at this point we don't even know the state of the device
|
// Best effort disconnect; at this point we don't even know the state of the device
|
||||||
pxt.reportException(e);
|
pxt.reportException(e);
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
return resp.confirmAsync({
|
return resp.confirmAsync({
|
||||||
header: lf("Something went wrong..."),
|
header: lf("Something went wrong..."),
|
||||||
body: lf("One-click download took too long. Please disconnect your {0} from your computer and reconnect it, then manually download your program using drag and drop.", pxt.appTarget.appTheme.boardName || lf("device")),
|
body: lf("One-click download took too long. Please disconnect your {0} from your computer and reconnect it, then manually download your program using drag and drop.", pxt.appTarget.appTheme.boardName || lf("device")),
|
||||||
disagreeLbl: lf("Ok"),
|
agreeLbl: lf("Ok"),
|
||||||
hideAgree: true
|
hideCancel: true
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -497,11 +498,12 @@ function flashAsync(resp: pxtc.CompileResult, d: pxt.commands.DeployOptions = {}
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} else {
|
} else {
|
||||||
pxt.tickEvent("hid.flash.unknownerror");
|
pxt.tickEvent("hid.flash.unknownerror");
|
||||||
|
pxt.reportException(e);
|
||||||
return resp.confirmAsync({
|
return resp.confirmAsync({
|
||||||
header: pxt.U.lf("Something went wrong..."),
|
header: pxt.U.lf("Something went wrong..."),
|
||||||
body: pxt.U.lf("Please manually download your program to your device using drag and drop. One-click download might work afterwards."),
|
body: pxt.U.lf("Please manually download your program to your device using drag and drop. One-click download might work afterwards."),
|
||||||
disagreeLbl: lf("Ok"),
|
agreeLbl: lf("Ok"),
|
||||||
hideAgree: true
|
hideCancel: true
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return pxt.commands.saveOnlyAsync(resp);
|
return pxt.commands.saveOnlyAsync(resp);
|
||||||
|
@ -13,6 +13,5 @@
|
|||||||
"newLine": "LF",
|
"newLine": "LF",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"jsx": "react"
|
"jsx": "react"
|
||||||
},
|
}
|
||||||
"prepend": ["../external/dapjs.js"]
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-common-packages": "6.5.20",
|
"pxt-common-packages": "6.5.20",
|
||||||
"pxt-core": "5.9.3"
|
"pxt-core": "5.9.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user