thread-loader
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.0.3"></a> | ||
## [1.0.3](https://github.com/webpack-contrib/thread-loader/compare/v1.0.2...v1.0.3) (2017-05-27) | ||
### Bug Fixes | ||
* **resolve:** fix passing error to worker ([6561f57](https://github.com/webpack-contrib/thread-loader/commit/6561f57)) | ||
<a name="1.0.2"></a> | ||
@@ -7,0 +17,0 @@ ## [1.0.2](https://github.com/webpack-contrib/thread-loader/compare/v1.0.1...v1.0.2) (2017-05-27) |
@@ -47,2 +47,10 @@ 'use strict'; | ||
function toNativeError(obj) { | ||
if (!obj) return null; | ||
var err = new Error(obj.message); | ||
err.details = obj.details; | ||
err.missing = obj.missing; | ||
return err; | ||
} | ||
function writeJson(data) { | ||
@@ -68,2 +76,3 @@ var lengthBuffer = new Buffer(4); | ||
resolve: function resolve(context, request, callback) { | ||
callbackMap[nextQuestionId] = callback; | ||
writeJson({ | ||
@@ -76,3 +85,2 @@ type: 'resolve', | ||
}); | ||
callbackMap[nextQuestionId] = callback; | ||
nextQuestionId += 1; | ||
@@ -184,4 +192,8 @@ }, | ||
if (callback) { | ||
callback(error, result); | ||
var nativeError = toNativeError(error); | ||
callback(nativeError, result); | ||
} else { | ||
console.error(`Worker got unexpected result id ${id}`); | ||
} | ||
delete callbackMap[id]; | ||
break; | ||
@@ -188,0 +200,0 @@ } |
@@ -191,6 +191,11 @@ 'use strict'; | ||
id: questionId, | ||
error, | ||
error: error ? { | ||
message: error.message, | ||
details: error.details, | ||
missing: error.missing | ||
} : null, | ||
result | ||
}); | ||
}); | ||
finalCallback(); | ||
break; | ||
@@ -197,0 +202,0 @@ } |
{ | ||
"name": "thread-loader", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Runs the following loaders in a worker pool.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29069
643