fiftyone.pipeline.core
Advanced tools
Comparing version 4.3.3 to 4.3.4
@@ -143,9 +143,12 @@ /* ********************************************************************* | ||
if (!this.errors[errorKey]) { | ||
this.errors[errorKey] = []; | ||
this.errors[errorKey] = error; | ||
let logMessage = "Error occurred during processing"; | ||
if (errorKey !== undefined) { | ||
logMessage = logMessage + " of " + errorKey + ". '" + error + "'"; | ||
} | ||
this.pipeline.log('error', { message: error, source: errorKey }); | ||
this.pipeline.log('error', logMessage); | ||
this.errors[errorKey].push(error); | ||
} | ||
@@ -152,0 +155,0 @@ |
{ | ||
"name": "fiftyone.pipeline.core", | ||
"version": "4.3.3", | ||
"version": "4.3.4", | ||
"description": "Core library for the 51Degrees Pipeline API", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -41,4 +41,6 @@ /* ********************************************************************* | ||
* add to the Pipeline | ||
* @param {Boolean} suppressProcessExceptions If true then pipeline | ||
* will suppress exceptions added to FlowData. | ||
*/ | ||
constructor (flowElements = []) { | ||
constructor (flowElements = [], suppressProcessExceptions = false) { | ||
const pipeline = this; | ||
@@ -49,2 +51,5 @@ | ||
// If true then pipeline will suppress exceptions added to FlowData. | ||
this.suppressProcessExceptions = suppressProcessExceptions; | ||
// A logger for emitting messages | ||
@@ -131,3 +136,7 @@ this.eventEmitter = new EventEmitter(); | ||
.catch(setError); | ||
}); | ||
if (flowData.errors !== undefined && Object.entries(flowData.errors).length !== 0 && !pipeline.suppressProcessExceptions) { | ||
throw Object.values(flowData.errors)[0]; | ||
} | ||
}); | ||
}; | ||
@@ -134,0 +143,0 @@ }; |
@@ -38,4 +38,5 @@ /* ********************************************************************* | ||
test('error data is populated', done => { | ||
syncPipeline.suppressProcessExceptions = true; | ||
syncFlowData.process().then(function () { | ||
expect(syncFlowData.errors.error[0]).toBe('Something went wrong'); | ||
expect(syncFlowData.errors.error).toBe('Something went wrong'); | ||
@@ -49,8 +50,10 @@ done(); | ||
syncPipeline.on('error', function (error) { | ||
log = error.message; | ||
console.log(error); | ||
log = error; | ||
}); | ||
test('logging', done => { | ||
syncPipeline.suppressProcessExceptions = true; | ||
syncFlowData.process().then(function () { | ||
expect(log).toBe('Something went wrong'); | ||
expect(log).toBe("Error occurred during processing of error. 'Something went wrong'"); | ||
@@ -61,2 +64,11 @@ done(); | ||
test("Don't Suppress Exception", done => { | ||
syncFlowData.process().then(function () { | ||
done(); | ||
}).catch((e) => { | ||
// When an error occurs, check that the expected values are populated. | ||
expect(e.indexOf('Something went wrong') !== -1).toBe(true); | ||
}); | ||
}); | ||
test('stop flag works', done => { | ||
@@ -63,0 +75,0 @@ syncFlowData.process().then(function () { |
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
195462
4601