Error Handling
The OLOClient provides comprehensive error handling:
JS
try {
await oloClient.connect('robot', null, {
serverUrl: 'wss://app.olo-robotics.com/rosbridge?robotId=robot'
});
await oloClient.publish('/test', { data: 'test' });
const session = await oloClient.startVideo('/camera/topic', videoElement);
} catch (error) {
if (error.message.includes('Not connected')) {
console.error('Connection lost, attempting to reconnect...');
} else if (error.message.includes('Topic not found')) {
console.error('Topic does not exist, check topic list');
} else {
console.error('Unexpected error:', error);
}
}