removed crappy exception class

This commit is contained in:
Bala Clark 2011-09-06 17:04:38 +02:00
parent aaafbbc12c
commit 752bf3b02f

View file

@ -4,7 +4,6 @@
TODOs: TODOs:
Fo sho: Fo sho:
- fix last page loading bug
- improve prev/next buttons, only show them when they can possibly work (not at beginning/end) - improve prev/next buttons, only show them when they can possibly work (not at beginning/end)
- check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com - check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com
- write bin scripts to minify & join all js - write bin scripts to minify & join all js
@ -54,16 +53,12 @@ function merge(a, b) {
* @param {Object} object * @param {Object} object
* @returns {ComicBookException} * @returns {ComicBookException}
*/ */
function ComicBookException(type, object) { var ComicBookException = {
INVALID_PAGE: "invalid page",
this.type = type; INVALID_PAGE_TYPE: "invalid page type",
this.object = object; UNDEFINED_CONTROL: "undefined control",
INVALID_ZOOM_MODE: "invalid zoom mode",
this.INVALID_PAGE = "invalid page"; INVALID_NAVIGATION_EVENT: "invalid navigation event"
this.INVALID_PAGE_TYPE = "invalid page type";
this.UNDEFINED_CONTROL = "undefined control";
this.INVALID_ZOOM_MODE = "invalid zoom mode";
this.INVALID_NAVIGATION_EVENT = "invalid navigation event";
}; };
function ComicBook(id, srcs, opts) { function ComicBook(id, srcs, opts) {
@ -348,7 +343,7 @@ function ComicBook(id, srcs, opts) {
ComicBook.prototype.getControl = function(control) { ComicBook.prototype.getControl = function(control) {
if (typeof this.control[control] === "undefined") { if (typeof this.control[control] === "undefined") {
throw new ComicBookException(ComicBookException.UNDEFINED_CONTROL, control); throw ComicBookException.UNDEFINED_CONTROL+' '+control;
} }
return this.control[control]; return this.control[control];
@ -394,7 +389,7 @@ function ComicBook(id, srcs, opts) {
ComicBook.prototype.getPage = function(i) { ComicBook.prototype.getPage = function(i) {
if (i < 0 || i > srcs.length) { if (i < 0 || i > srcs.length) {
throw new ComicBookException(ComicBookException.INVALID_PAGE, i); throw ComicBookException.INVALID_PAGE+' '+i;
} }
if (typeof pages[i] === "object") { if (typeof pages[i] === "object") {
@ -525,8 +520,9 @@ function ComicBook(id, srcs, opts) {
if (options.displayMode === "double" && pointer < srcs.length-1) { if (options.displayMode === "double" && pointer < srcs.length-1) {
page2 = ComicBook.prototype.getPage(pointer + 1); page2 = ComicBook.prototype.getPage(pointer + 1);
} }
if (typeof page !== "object") { if (typeof page !== "object") {
throw new ComicBookException(ComicBookException.INVALID_PAGE_TYPE, typeof page); throw ComicBookException.INVALID_PAGE_TYPE+' '+typeof page;
} }
var width = page.width; var width = page.width;
@ -572,7 +568,7 @@ function ComicBook(id, srcs, opts) {
break; break;
default: default:
throw new ComicBookException(ComicBookException.INVALID_ZOOM_MODE, options.zoomMode); throw ComicBookException.INVALID_ZOOM_MODE+' '+options.zoomMode;
} }
var canvas_width = page.width * zoom_scale; var canvas_width = page.width * zoom_scale;
@ -802,9 +798,7 @@ function ComicBook(id, srcs, opts) {
} }
break; break;
default: default:
throw new ComicBookException( throw ComicBookException.INVALID_NAVIGATION_EVENT+' '+e.type;
ComicBookException.INVALID_NAVIGATION_EVENT, e.type
);
} }
if (side) { if (side) {