Skip to main content
Example of error message displayed in Blink UI Proper error handling is crucial for Blinks as it provides users with clear feedback when something goes wrong. When an error occurs, the ActionError object displays the error message directly in the Blink UI, preventing failed transactions and improving user experience.

Key Concepts

  • ActionError Object: Wrap error messages in ActionError to display them in the Blink UI
  • Input Validation: Always validate user inputs before processing transactions
  • User-Friendly Messages: Provide clear, actionable error messages that help users understand what went wrong
  • HTTP Status Codes: Use appropriate status codes (400 for validation errors, 500 for server errors)

Best Practices

Input Validation

Validate all inputs before expensive operations

User-Friendly Messages

Use specific error messages that guide users to the solution

Graceful Error Handling

Always catch and handle errors gracefully

Server-Side Logging

Log errors server-side for debugging while showing user-friendly messages in the UI

Error Handling Example

Here’s how to implement input validation and error handling in our donation Blink example: