The PCDLoader doesn't handle errors well. If there's an error when parsing, the error handler passed in is not called and the resulting exception is only caught by a global process handler. This may apply to all loaders as if there's an error in the setTimeout method used for loading there's no way to catch that exception.
var url = 'https://threejs.org/examples/textures/sprites/disc.png';
var loader = new THREE.PCDLoader().load(
url,
() => alert('something loaded'),
() => {},
() => alert('error handler - never gets called')
);
any
Could you attach files here that the loader has trouble parsing?
Sure. Here's an image file:

Maybe something like this would help to improve error handling:
try {
onLoad( scope.parse( data, url ) );
} catch ( e ) {
if ( onError ) onError( e );
}
The onError() callback of PCDLoader.load() would now be able to handle exceptions caused by an invalid format.
Don鈥檛 think that will work. The onLoad method calls setTimeout internally. I would think you鈥檇 need to put the try catch there
I was able to catch the error with this code when trying to load the following URL with PCDLoader:
https://threejs.org/examples/textures/sprites/disc.png
Can you also give it a try?
You're right. That worked. I'm surprised given that it does seem to be calling onLoad in a setTimeout, but perhaps because the timeout is 0?
It would be good to add a re-throw if no onError method is specified, but otherwise that seems to solve the issue.
Would you like to do a PR and add the code snippet to PCDLoader:innocent:?
Sure. Why not? I'll get something up later today
Most helpful comment
Sure. Why not? I'll get something up later today