Merge pull request #33 from mykmelez/class-not-found-exception

make ClassNotFoundException a subclass of Error
This commit is contained in:
Andreas Gal 2014-08-05 12:18:49 -07:00
Родитель 8a45a2256d a798f31116
Коммит 010fcf8dc3
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -13,8 +13,12 @@ var Classes = function() {
}
}
Classes.ClassNotFoundException = function() {
}
Classes.ClassNotFoundException = function(message) {
this.message = message;
};
Classes.ClassNotFoundException.prototype = Object.create(Error.prototype);
Classes.ClassNotFoundException.prototype.name = "ClassNotFoundException";
Classes.ClassNotFoundException.prototype.constructor = Classes.ClassNotFoundException;
Classes.prototype.addPath = function(name, data) {
if (name.substr(-4) === ".jar") {
@ -63,7 +67,7 @@ Classes.prototype.loadClassFile = function(fileName) {
console.info("loading " + fileName + " ...");
var bytes = this.loadFile(fileName);
if (!bytes)
throw new (Classes.ClassNotFoundException)();
throw new (Classes.ClassNotFoundException)(fileName);
var self = this;
var classInfo = this.loadClassBytes(bytes);
if (classInfo.superClassName)