Handling errors

The best way to handle errors is to try to prevent them. Ask target users to test your application as you’re designing it and adjust the workflow to help users avoid encountering errors. Any work that you do while you’re designing your application can save users from being frustrated or annoyed when they use your application. For example,

  • Prompt users with default values.
  • Create fields of an appropriate size. The size of a field indicates how much information users should expect to enter.
  • Be flexible with formats. For example, for phone numbers, accept (519) 555-0199, 5195550199, and 519-555-0199.

Carefully consider whether you need to inform users of an error. If you do need to inform users of an error, expose the error in as moderate a way as possible.

Type Examples Action
Inline

Always consider using this type of notification first.

This screen shows an inline error.

  • Entering an incomplete email address
  • Entering an incorrect password

Attach the notification to the affected item. You can add a subtle side to side animation to emphasize the location of the error.

This approach allows users to continue without being blocked by an error.

Toast

If an inline notification isn’t possible, consider a toast.

This screen shows a toast error.

  • Uploading an image was not successful
  • New messages do not appear because the device is not 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.

This approach allows users to continue without being blocked by an error.

Dialog

Use when users must be informed explicitly of an error.

This screen shows a dialog error.

Restarting an application

Display an inquiry dialog which requires users to take action before being able to continue.

This approach makes sure that users are aware of the error.

Best practices

  • Inform users of errors as quickly as possible. For example, if users enter an incorrect phone number, display an inline notification as soon as users leave the text field. 
  • Keep action buttons inactive (for example, Send, Share, or Next) until users enter the required information and the information is validated. 
  • Help users recover from errors by suggesting a solution rather than just stating the problem. For example, if a device is not connected to a wireless network, prompt users to turn on Wi-Fi.
  • Offer to remedy situations that affect the performance of the application. For example, if users have a large number of tabs open in the browser, you could suggest that users close some tabs to improve the browsing experience.
  • Avoid informing users of successful actions. Users should feel confident in the success of their actions.
  • Don't reset values that users have entered unless the values are confidential, such as passwords.

Was this information helpful? Send us your comments.