@@ -58,10 +58,10 @@ angular.module('FredrikSandell.worker-pool', []).service('WorkerService', [
58
58
that . createAngularWorker = function ( depFuncList ) {
59
59
//validate the input
60
60
if ( ! Array . isArray ( depFuncList ) || depFuncList . length < 3 || typeof depFuncList [ depFuncList . length - 1 ] !== 'function' ) {
61
- throw 'Input needs to be: [\'input\',\'output\'/*optional additional dependencies*/,\n' + ' function(workerInput, deferredOutput /*optional additional dependencies*/)\n' + ' {/*worker body*/}' + ']' ;
61
+ throw new Error ( 'Input needs to be: [\'input\',\'output\'/*optional additional dependencies*/,\n' + ' function(workerInput, deferredOutput /*optional additional dependencies*/)\n' + ' {/*worker body*/}' + ']' ) ;
62
62
}
63
63
if ( typeof urlToAngular !== 'string' ) {
64
- throw 'The url to angular must be defined before worker creation' ;
64
+ throw new Error ( 'The url to angular must be defined before worker creation' ) ;
65
65
}
66
66
var deferred = $q . defer ( ) ;
67
67
var dependencyMetaData = createDependencyMetaData ( extractDependencyList ( depFuncList ) ) ;
@@ -123,7 +123,7 @@ angular.module('FredrikSandell.worker-pool', []).service('WorkerService', [
123
123
initializedWorker . addEventListener ( 'message' , function ( e ) {
124
124
var eventId = e . data . event ;
125
125
if ( eventId === 'initDone' ) {
126
- throw 'Received worker initialization in run method. This should already have occurred!' ;
126
+ throw new Error ( 'Received worker initialization in run method. This should already have occurred!' ) ;
127
127
} else if ( eventId === 'success' ) {
128
128
deferred . resolve ( e . data . data ) ;
129
129
} else if ( eventId === 'failure' ) {
0 commit comments