1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Removes error()

This commit is contained in:
Yury Delendik 2017-06-28 13:51:31 -07:00
parent ac9802809c
commit d028c26210
24 changed files with 318 additions and 260 deletions

View file

@ -14,8 +14,8 @@
*/
import {
assert, CMapCompressionType, error, isInt, isString, MissingDataException,
Util, warn
assert, CMapCompressionType, FormatError, isInt, isString,
MissingDataException, Util, warn
} from '../shared/util';
import { isCmd, isEOF, isName, isStream } from './primitives';
import { Lexer } from './parser';
@ -354,19 +354,19 @@ var IdentityCMap = (function IdentityCMapClosure() {
addCodespaceRange: CMap.prototype.addCodespaceRange,
mapCidRange(low, high, dstLow) {
error('should not call mapCidRange');
throw new Error('should not call mapCidRange');
},
mapBfRange(low, high, dstLow) {
error('should not call mapBfRange');
throw new Error('should not call mapBfRange');
},
mapBfRangeToArray(low, high, array) {
error('should not call mapBfRangeToArray');
throw new Error('should not call mapBfRangeToArray');
},
mapOne(src, dst) {
error('should not call mapCidOne');
throw new Error('should not call mapCidOne');
},
lookup(code) {
@ -403,7 +403,7 @@ var IdentityCMap = (function IdentityCMapClosure() {
},
get isIdentityCMap() {
error('should not access .isIdentityCMap');
throw new Error('should not access .isIdentityCMap');
},
};
@ -472,7 +472,7 @@ var BinaryCMapReader = (function BinaryCMapReaderClosure() {
do {
var b = this.readByte();
if (b < 0) {
error('unexpected EOF in bcmap');
throw new FormatError('unexpected EOF in bcmap');
}
last = !(b & 0x80);
n = (n << 7) | (b & 0x7F);
@ -494,7 +494,7 @@ var BinaryCMapReader = (function BinaryCMapReaderClosure() {
do {
var b = this.readByte();
if (b < 0) {
error('unexpected EOF in bcmap');
throw new FormatError('unexpected EOF in bcmap');
}
last = !(b & 0x80);
stack[sp++] = b & 0x7F;
@ -711,13 +711,13 @@ var CMapFactory = (function CMapFactoryClosure() {
function expectString(obj) {
if (!isString(obj)) {
error('Malformed CMap: expected string.');
throw new FormatError('Malformed CMap: expected string.');
}
}
function expectInt(obj) {
if (!isInt(obj)) {
error('Malformed CMap: expected int.');
throw new FormatError('Malformed CMap: expected int.');
}
}
@ -770,7 +770,7 @@ var CMapFactory = (function CMapFactoryClosure() {
break;
}
}
error('Invalid bf range.');
throw new FormatError('Invalid bf range.');
}
function parseCidChar(cMap, lexer) {
@ -832,7 +832,7 @@ var CMapFactory = (function CMapFactoryClosure() {
var high = strToInt(obj);
cMap.addCodespaceRange(obj.length, low, high);
}
error('Invalid codespace range.');
throw new FormatError('Invalid codespace range.');
}
function parseWMode(cMap, lexer) {