Skip to content

Commit

Permalink
refactor: use reject not return false
Browse files Browse the repository at this point in the history
- Use reject to catch exception better than return false
  • Loading branch information
Chinlinlee committed Mar 16, 2023
1 parent 91e3d84 commit cf2bbeb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions models/dcmtk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function dcm2json(filename) {
const dcm2jsonC = require('dicom-to-json');
const dcm2jsonV8 = {
exec : function (dcmfile) {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
try {
dcm2jsonC.dcm2json(dcmfile , function (data) {
data = data.replace(/,\\u0000/g, '');
Expand All @@ -103,8 +103,7 @@ const dcm2jsonV8 = {
return resolve(obj);
});
} catch (e) {
console.error(e);
return resolve(false);
return reject(new Error(e));
}
});
} ,
Expand Down

0 comments on commit cf2bbeb

Please sign in to comment.