Before you handle errors, try to avoid them. The more errors you can handle and remove during development, the happier your app users will be. Here are some ways you can avoid errors:
- While you're designing your app, test with target users and adjust the workflow to help users avoid errors.
- Prompt users with default values.
- Create fields with a size that reflects how much information users should enter.
- Be flexible with formats. For example, for phone numbers, accept (519) 555-0199, 5195550199, and 519-555-0199.
If you need an error
Carefully consider whether you need to inform users of an error. If you do, do it in the least disruptive way you can.
Inline notifications keep users in the context of their task and don't force them to respond before continuing.
- Entering only part of an email address
- Entering the wrong password
Attach the notification to the affected item. You can add a subtle side to side animation to show where the error is.
Use a toast when an inline notification isn’t possible. Toasts also let users to continue without being blocked.
- An image didn't upload successfully
- New messages don't appear because the device isn't connected to a wireless network
Display a toast on the screen. Once users start to interact with the screen, the toast should disappear after 3 seconds.
Use a dialog when users must be aware of the error.
Restarting an application
Display an inquiry dialog that users must respond to before they can continue.
Tell users about errors as soon as you can. If users enter an incorrect phone number, you could display an inline notification as soon as they leave the text field.
Keep action buttons inactive (like Send, Share, or Next) until users enter the required information and it's validated.
Suggest a solution. Don't just state the problem; help users recover. If a device isn't connected to a wireless network, you could prompt users to turn on Wi-Fi.
Offer to fix issues that affect performance. If users have a lot of browser tabs open, you could suggest closing some to improve browsing.
Don't tell users about successful actions. Let them feel confident in the success of their actions.
Don't reset values that users have entered unless the values are confidential, such as passwords.