donejs / donejs/done-component
Unhandled Promise Rejection in component.js (TypeError: Module is already loading)
- Dominant language
- JavaScript
- Stars
- 8
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
I'm getting the following error in my console when running `donejs develop`:
```
TypeError: Module is already loading.
at Loader.define (/Users/kcarmonamurphy/Projects/ting-node-upgrade/node_modules/steal/src/loader/loader.js:1082:15)
at file:/Users/kcarmonamurphy/Projects/ting-node-upgrade/node_modules/done-component/component.js:229:16
(node:2512) UnhandledPromiseRejectionWarning: TypeError: Module is already loading.
at Loader.define (/Users/kcarmonamurphy/Projects/ting-node-upgrade/node_modules/steal/src/loader/loader.js:1082:15)
at file:/Users/kcarmonamurphy/Projects/ting-node-upgrade/node_modules/done-component/component.js:229:16
(node:2512) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2512) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```
Starting on line 226 in `component.js`, we can see that there is no `.catch()` block:
```js
if(typeof defn.source !== "string") {
return Promise.resolve(defn.source)
.then(function(source){
loader.define(moduleName, source, {
address: address(defn.name),
metadata: defn.metadata
});
});
}
```
I would gladly help write up a PR for this but I'm not sure what the best way to handle any errors would be here. Simply output error message to console or try to dig deeper to find root cause of error (or both?). Looking for some guidance.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with `donejs develop`, then inspect `component.js` around lines 226-229 and the reported `Loader.define` path in `steal/src/loader/loader.js`. Determine how this rejection should be surfaced without hiding the underlying module-loading error, and verify that the resulting behavior no longer produces an unhandled rejection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100