-
Notifications
You must be signed in to change notification settings - Fork 126
[CB-INTERNAL] move components-details and repository to promises #1265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CB-INTERNAL] move components-details and repository to promises #1265
Conversation
const dirDetails = await getFromDirectories({ | ||
componentsList, | ||
details: jsonDetails | ||
}).catch(err => returnError('components_details_get', err)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returnError
will throw and thus refresh
will finish on this line in case of error, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, if you throw inside catch
its like rethrowing
if (componentName === 'oc-client') { | ||
return callback(null, [ | ||
fs.readJsonSync(path.join(__dirname, '../../../package.json')).version | ||
return Promise.all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why Promise.all
and not Promise.resolve
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's an array of promises, not a promise of an array.
callback(null, [ | ||
fs.readJsonSync(path.join(conf.path, `${componentName}/package.json`)) | ||
.version | ||
return Promise.all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's an array of promises, not a promise of an array.
Fully move components-details and repository to Promises