...
Do not use in-line alerts to inform the user of a problem they cannot fix, such as if the service is unavailable – Use a product alert instead
Best Practices
Do
Display in-line alerts after a change in context, for example, when a user clicks a link or submits a form, launching a new page or an updated view
Ensure that error messages are clear, concise and easy to understand - Please see the Guidelines for Error and Validation Messaging article
Ensure that the error summary includes a heading that clearly conveys the purpose of the alert (for example, “Error”)
Use an appropriate status – Please see the Guidelines for Alerts article
When using the error summary, include in-page anchor links to the corresponding form controls to make it easier for users to get to the error they need to fix
...