OBJLoader2 _throwError not a function, onError not called
See original GitHub issueDescription of the problem
OBJLoader2 is crashing on certain invalid files. I get an error:
Uncaught TypeError: this._throwError is not a function at THREE.OBJLoader2.Parser.processCompletedMesh (OBJLoader2.js:1209) at THREE.OBJLoader2.Parser.checkFaceType (OBJLoader2.js:1034) at THREE.OBJLoader2.Parser.processLine (OBJLoader2.js:961) at THREE.OBJLoader2.Parser.parse (OBJLoader2.js:778) at THREE.OBJLoader2.parse (OBJLoader2.js:378) at Object.fileLoaderOnLoad [as onLoad] (OBJLoader2.js:241) at XMLHttpRequest.<anonymous> (three.js:34525)
Seems like Parser doesn’t have this function, just OBJLoader2 itself?
The bigger issue though is that, when this happens, my onError callback I passed to OBJLoader2.load isn’t called, and neither is onLoad. It seems like this error just vanishes. Since I’m wrapping my OBJLoader2.load call in a promise, this ends up causing problems since I can’t resolve/reject the promise, and my application can’t finish loading
Three.js version
latest
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
@zacaj and @Mugen87 I will investigate…
Problem is fixed. onError callback function from
OBJLoader2is now properly passed on (with correct scope) if defined.