Skip to main content
This guide covers how to handle SmartMenu API errors gracefully, ensuring a good user experience even when things go wrong.

GraphQL Error Format

SmartMenu API returns errors in the standard GraphQL format:

Error Codes

Authentication Errors

Validation Errors

Rate Limiting

Server Errors

Handling Errors in Code

Basic Error Handler

Error Classes

Centralized Error Handler

Graceful Degradation

When SmartMenu API is unavailable, your app should continue to function.

Fallback Pattern

UI Fallback

Retry Logic

Exponential Backoff

Rate Limit Handling

User-Facing Error Messages

Logging and Monitoring

Best Practices

Always Handle Errors

Never let errors bubble up to crash your app. Always catch and handle.

User-Friendly Messages

Don’t show technical error messages to users. Translate to helpful guidance.

Fail Gracefully

If nutrition isn’t available, the dish should still be orderable.

Log for Debugging

Log errors with context for debugging, but don’t expose details to users.