Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Here it is chewed up.
https://stackoverflow.com/questions/912334/differe...
In fact, exceptions are errors, but we can process some, we break on others.
For example, WebException is predictable in principle, I have a lousy channel and I try again, FormatException outputs something to the log.
I simply extinguish everything at the application level so as not to destroy it, write it to the log and offer the user a button to scold me or try again .
UPD
Most importantly, I forgot
https://docs.microsoft.com/ru-ru/dotnet/standard/e. ..
Well, what's my mistake if you make me divide by zero? Or are you asking me to open a file that you didn't create for some reason? Or so scored the memory that I did not have enough? Therefore, I inform you about an exceptional situation, the consequences of which you need to rake, and not me - a normal function. Perhaps this is your mistake. And my code works fine.
Error (bug) - there are no exceptions here:
decimal Умножить(decimal множитель1, decimal множитель2)
{
// программист перепутал операторы
return множитель1 + множитель2;
}
string ReadFileTextUtf8(string fileName)
{
if (String.IsNullOrEmpty(fileName))
throw new ArgumentNullException("fileName");
return File.ReadAllText(fileName, Encoding.UTF8);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question