From 2907827d31999489f88f0eff524448da652cf18b Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sat, 23 Jun 2018 21:20:53 +0200 Subject: [PATCH] Replace `NotImplementedException` with `unreachable` --- src/core/pdf_manager.js | 14 +++++++------- src/shared/util.js | 13 ------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/core/pdf_manager.js b/src/core/pdf_manager.js index 9ed6be87f..15b456b10 100644 --- a/src/core/pdf_manager.js +++ b/src/core/pdf_manager.js @@ -15,7 +15,7 @@ import { createPromiseCapability, createValidAbsoluteUrl, MissingDataException, - NotImplementedException, shadow, unreachable, Util, warn + shadow, unreachable, Util, warn } from '../shared/util'; import { ChunkedStreamManager } from './chunked_stream'; import { PDFDocument } from './document'; @@ -49,7 +49,7 @@ var BasePdfManager = (function BasePdfManagerClosure() { }, onLoadedStream: function BasePdfManager_onLoadedStream() { - throw new NotImplementedException(); + unreachable('Abstract method `onLoadedStream` called'); }, ensureDoc: function BasePdfManager_ensureDoc(prop, args) { @@ -73,19 +73,19 @@ var BasePdfManager = (function BasePdfManagerClosure() { }, ensure: function BasePdfManager_ensure(obj, prop, args) { - return new NotImplementedException(); + unreachable('Abstract method `ensure` called'); }, requestRange: function BasePdfManager_requestRange(begin, end) { - return new NotImplementedException(); + unreachable('Abstract method `requestRange` called'); }, requestLoadedStream: function BasePdfManager_requestLoadedStream() { - return new NotImplementedException(); + unreachable('Abstract method `requestLoadedStream` called'); }, sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) { - return new NotImplementedException(); + unreachable('Abstract method `sendProgressiveData` called'); }, updatePassword: function BasePdfManager_updatePassword(password) { @@ -93,7 +93,7 @@ var BasePdfManager = (function BasePdfManagerClosure() { }, terminate: function BasePdfManager_terminate() { - return new NotImplementedException(); + unreachable('Abstract method `terminate` called'); }, }; diff --git a/src/shared/util.js b/src/shared/util.js index 19a331f67..1a18c5dfe 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -443,18 +443,6 @@ var UnexpectedResponseException = return UnexpectedResponseException; })(); -var NotImplementedException = (function NotImplementedExceptionClosure() { - function NotImplementedException(msg) { - this.message = msg; - } - - NotImplementedException.prototype = new Error(); - NotImplementedException.prototype.name = 'NotImplementedException'; - NotImplementedException.constructor = NotImplementedException; - - return NotImplementedException; -})(); - var MissingDataException = (function MissingDataExceptionClosure() { function MissingDataException(begin, end) { this.begin = begin; @@ -1037,7 +1025,6 @@ export { MissingDataException, MissingPDFException, NativeImageDecoding, - NotImplementedException, PasswordException, PasswordResponses, StreamType,