5 Part Formula for Writing Error Messages

error-message-formula

How can we write error message that are both helpful and human?

Error messages fall into three categories: informational, warning, or errors.

Error Message: 5 Part Format

Most messages contain these parts:

  1. Error number — a one-to-five-digit number that identifies the message. User-defined messages may contain more digits.
  2. Description — a Unicode string that contains information about the condition that generated the message.
  3. Severity level — a one- or two-digit number that indicates the severity of the error condition.
  4. State — a one- to three-digit number with a maximum value that indicates the location in the code that generated the message:
  5. Line number — a number in a stored procedure that contains the statement that generated the message.

For example

Error number: 6696

Severity level: 8

State: 2

Line: 5

Description: Invalid object name ‘ObjectMissing’.

That help?

Stay tuned for the next episode!

Have you got these templates?