DDP.connect returns a Connection object with several properties. One of them is status (and it’s reactive). You can check the status of the returned connection object; when it’s set to failed you can then process your desired error handling.
As a quick example (I’m setting retry to false so that if you test this out you can see it fail pretty quickly):
/client/main.js
import { Tracker } from 'meteor/tracker';
const connection = DDP.connect('asdf', { retry: false });
Tracker.autorun(() => {
if (connection.status().status === 'failed') {
console.log('Oh no!');
}
});