question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OBJLoader2 _throwError not a function, onError not called

See original GitHub issue
Description 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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kaisalmencommented, Apr 24, 2019

@zacaj and @Mugen87 I will investigate…

0reactions
kaisalmencommented, May 3, 2019

Problem is fixed. onError callback function from OBJLoader2 is now properly passed on (with correct scope) if defined.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular2 Observarble onError not a function - Stack Overflow
In RxJs 5 observer's methods were renamed. You should use error instead of onError .
Read more >
Node.js Error Handling Best Practices: Ship With Confidence
Want to ship your Node.js applications with confidence? Learn Node.js error handling best practices, tips and tricks with our simple guide.
Read more >
A mostly complete guide to error handling in JavaScript.
Here we check if the function argument is a string. If it's not we throw an exception. Technically, you could throw anything in...
Read more >
Chapter 5: Error Handling - Eloquent JavaScript
When some geek tries to call power("Rabbit", 4) , that is quite obviously a programmer error, but how about power(9, 0.5) ? The...
Read more >
RxJs Error Handling: Complete Practical Guide
we are passing to the catchError operator a function, which is the error handling function; the error handling function is not called ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found