Added some minor exception handling improvements

This commit is contained in:
Jeff Parsons 2014-10-30 12:06:26 -07:00 • committed by jeffpar
commit c2a89b07dd
12 changed files with 1141 additions and 1140 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -1114,10 +1114,7 @@ C1PCPU.prototype.run = function()
this.halt();
this.update();
this.setBusy(false);
//
// System exceptions throw an object with a message property, whereas exceptions I throw myself do not (they're just strings)
//
this.setError(e.message || e);
this.setError(e.message);
return;
}
setTimeout(function(cpu) { return function() {cpu.run();}; }(this), this.calcRemainingTime());

View file

@ -802,7 +802,7 @@ C1PDiskController.prototype.loadDisk = function(sDiskName, sDiskData, nErrorCode
* start with the most egregious, and worry about the rest later.
*/
if ((iTrackNum = track['trackNum']) === undefined || sectors === undefined) {
throw("track " + iTrack + " missing data");
throw new Error("track " + iTrack + " missing data");
}
/*
* WARNING: We allow out-of-order tracks, because we store each track's data according
@ -854,10 +854,7 @@ C1PDiskController.prototype.loadDisk = function(sDiskName, sDiskData, nErrorCode
this.aDrives[0].aTracks = aTracks;
this.println("mount of " + sDiskName + " complete");
} catch (e) {
//
// System exceptions throw an object with a message property, whereas exceptions I throw myself do not (they're just strings)
//
this.println("disk data error: " + (e.message || e));
this.println("disk data error: " + e.message);
}
};
@ -871,7 +868,7 @@ C1PDiskController.prototype.pushBCD = function(a, o, k)
{
var n = o[k];
if (n === undefined) {
throw("missing bcd value: " + k);
throw new Error("missing bcd value: " + k);
}
var bcd = (Math.floor(n / 10) << 4) | (n % 10);
a.push(bcd);
@ -888,7 +885,7 @@ C1PDiskController.prototype.pushBin = function(a, o, k, cb)
{
var n = o[k];
if (n === undefined) {
throw("missing binary value: " + k);
throw new Error("missing binary value: " + k);
}
if (cb == 2) {
a.push((n >> 8) & 0xff);
@ -906,7 +903,7 @@ C1PDiskController.prototype.pushSig = function(a, o, k)
{
var s = o[k];
if (s === undefined) {
throw("missing signature: " + k);
throw new Error("missing signature: " + k);
}
for (var i=0; i < s.length; i++) {
a.push(s.charCodeAt(i));

View file

@ -165,10 +165,7 @@ C1PROM.prototype.convertImage = function(sImageName, sImageData, nErrorCode)
*/
this.abImage = eval("(" + sImageData + ")");
} catch (e) {
//
// System exceptions throw an object with a message property, whereas exceptions I throw myself do not (they're just strings)
//
this.println("Error processing ROM \"" + sImageName + "\": " + (e.message || e));
this.println("Error processing ROM \"" + sImageName + "\": " + e.message);
return;
}
}

View file

@ -4476,6 +4476,7 @@ if (DEBUGGER) {
{
var result = true;
try {
if (!sCmd.length) {
if (this.fAssemble) {
this.println("ended assemble @" + this.hexAddr(this.aAddrAssemble));
@ -4483,7 +4484,6 @@ if (DEBUGGER) {
this.fAssemble = false;
}
}
sCmd = sCmd.toLowerCase();
if (this.isReady() && !this.isBusy(true) && sCmd.length > 0) {
if (this.fAssemble) {
@ -4601,6 +4601,10 @@ if (DEBUGGER) {
break;
}
}
} catch(e) {
this.println("debugger sad: " + e.message);
result = false;
}
return result;
};

View file

@ -717,9 +717,13 @@ web.onExit = function(fn)
web.doPageEvent = function(afn)
{
if (web.fPageEventsEnabled) {
try {
for (var i = 0; i < afn.length; i++) {
afn[i]();
}
} catch(e) {
Component.notice("An unexpected exception occurred:\n\n" + e.message + "\n\nPlease send this information to Jeff@pcjs.org. Thanks.");
}
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long