Handle Device Identification errors, timeouts, rate limits, and edge cases. Includes error codes, retry strategies, and fallback patterns.
Handle errors gracefully in production to prevent silent failures.
try { const result = await tc.get(); console.log(result.visitorId);} catch (error) { if (error.message === 'timeout') { // Collection took too long — retry or use fallback console.warn('Signal collection timed out'); } else if (error.message === 'network') { // Network error — API unreachable console.error('API connection failed'); } else { // Unknown error console.error('Identification failed:', error); }}Common error types:
| Error | Cause | Solution |
|---|---|---|
timeout | Signal collection exceeded timeout | Increase timeout or reduce signal set |
network | API endpoint unreachable | Check endpoint URL, proxy config |
auth | Invalid API key | Verify key in dashboard |
rate_limit | Too many requests | Implement backoff, check plan limits |