Код ошибки в Exception
Был когда-то в нашей команде DMSF очень горячий спор о том, следует ли в Exception -ах добавлять код ошибки, как например, у SqlException . Сегодня нашел замечание по-этому поводу в блоге Krzysztof Cwalina . Выдержка: Do not return error codes. Exceptions are the primary means of reporting errors in frameworks. The chapter overview section describes the benefits of exceptions in detail. Annotation (Krzysztof Cwalina): It’s ok for exceptions to have a property returning some kind of error code, but I would be very careful about this also. Each exception should carry two main pieces of information: the exception message explaining to the developer what went wrong and how to fix it and the exception type that should be used by handlers to decide what programmatic action to take. If you think you need to have a property on your exception that would return additional error code, think who this code is for. Is it for the developer or for the exception handler? If for the developer, add addi...