Do you end your exception messages with a period? [closed]

I've seen both exception messages with and without a period. And I can think of some reasons of why both could be good.

  • No dot would give you the freedom to add the period or leave it out if you wanted to. Could be useful if the message was going in some sort of a title bar or something.
  • With a dot, you would always know that you had a "complete sentence" and it looks more finished.

Which one do you recommend?

Could also be an issue in localized resource strings. Obviously, you can't put a period after everything (would look weird with periods after text on buttons and menu items, etc.). But should you then leave the period out from everything to be consistent and add it later where useful? Or would you rather put a period where it seems fit? For example, after all resource strings and exception messages that are sentences, but not after those that are words. But then, how about very short sentences? Like, "Create a new file", for example. Could maybe leave out periods for strings that were considered actions as well... (Just thinking while I'm typing here...)

Not the most important thing in the world, I know, but small things like this that tend to bug me after a while. I like consistency and to know why I do what I do. Problem is, I'm not sure which one to go for :p


Yes I usually treat the exception messages as full sentences, ending them with a period.

However, the message in the exception is meant for the developer, and not the end user. It may very well be that the same underlying exception should result in two different messages for the end user, depending on the context in which the exception-throwing method was called.

You really should show less technical, more user friendly messages to the user.


Q. Do you end your exception messages with a period?

From Best Practices for Exceptions on MSDN in the section "Creating and raising exceptions":

  • Use grammatically correct error messages, including ending punctuation. Each sentence in a description string of an exception should end in a period. For example, "The log table has overflowed.” would be an appropriate description string.

And regarding possible feedback to the user via the the application user interface, the question includes:

...Could also be an issue in localized resource strings.

The MSDN article referenced above also states:

  • Include a localized description string in every exception. The error message that the user sees is derived from the description string of the exception that was thrown, and not from the exception class.

Also, from Exception.Message Property at the beginning of the section "Remarks":

Error messages target the developer who is handling the exception. The text of the Message property should completely describe the error and, when possible, should also explain how to correct the error. Top-level exception handlers may display the message to end-users, so you should ensure that it is grammatically correct and that each sentence of the message ends with a period. Do not use question marks or exclamation points. If your application uses localized exception messages, you should ensure that they are accurately translated.


.NET Framework 4.6 and 4.5


Exception messages in the framework are dot-terminated; I tend to do the same for that reason.
In any case, choose a style and try to stick to that...


I always use periods in my exception descriptions. The simple fact is that sentences which are properly punctuated are easier to read and more professional-looking, which is important for perceived quality - don't you think?

Compare it to:

i always use periods in my exception descriptions the simple fact is that sentences which are properly punctuated are easier to read and more professional looking which is important for perceived quality dont you think