C# - Exception handling in frameworks -
i have write ftp (auth tsl) framework in c#. i'm noob @ writing frameworks.
e.g. when prove file exists , doesn't, should do?
- throwing exception programmer uses framwork?
- printing exceptionmessage (console.writeline()) without throwing exception?
what professional in case?
broad question actually, there clues on way:
- never use
console.writeline()
or stuff in framework. - for methods
framework.fileexists
, if file doesn't exist, returnfalse
value. that's true nature of boolean return value. that's more semantic. - for operations encounter problems, throw custom, or predefined exception. example, if need argument , want sure no null has been passed method, check argument in method's body , if it's null, throw
argumentnullexception
.
Comments
Post a Comment