Some of the developers are using the following syntax in RaiseError:
RAISERROR('My business error message', 16, 0)
With the purpose of reusing the catch part of the try..catch block for business error too.
But I spotted several event log entries like this:
Msg # 50006, <blabla> please register the error message with sp_addmessage
There's some way to disable the creation of such events? I searched google, msdn and docs but didn't find a clue.
It means some other developers are using
RAISERROR(50006, 16,1)
... When the msgid syntax is used (or when the @local_variable in thesyntax is an int) the expectation is that the message was added to the local messages table. This is the normal approach for localized errors, to raiserror a msgid and add messages localized for various languages.Whatever application/developer uses the msgid syntax, he/she is also responsible to add the message to the messages table during deployment, for the locale of the server.
This will tell SQL Server to raise a non fatal error.
Ref: http://www.sqlteam.com/article/handling-errors-in-stored-procedures