How do you hide error handling? [duplicate]
This question already has answers here: Using “catching exceptions” to improve readability, Good or Bad? (4 answers) Closed 11 years ago. Many people consider exceptions to be a problem because they create invisible paths through your code. For example in this snippet: function writeToFile(text, filename): filehandle = open(filename) foreach line in text: filehandle.write(line) filehandle.close() The […]
How do you hide error handling? [duplicate]
This question already has answers here: Using “catching exceptions” to improve readability, Good or Bad? (4 answers) Closed 11 years ago. Many people consider exceptions to be a problem because they create invisible paths through your code. For example in this snippet: function writeToFile(text, filename): filehandle = open(filename) foreach line in text: filehandle.write(line) filehandle.close() The […]
How do you hide error handling? [duplicate]
This question already has answers here: Using “catching exceptions” to improve readability, Good or Bad? (4 answers) Closed 11 years ago. Many people consider exceptions to be a problem because they create invisible paths through your code. For example in this snippet: function writeToFile(text, filename): filehandle = open(filename) foreach line in text: filehandle.write(line) filehandle.close() The […]
How do you hide error handling? [duplicate]
This question already has answers here: Using “catching exceptions” to improve readability, Good or Bad? (4 answers) Closed 11 years ago. Many people consider exceptions to be a problem because they create invisible paths through your code. For example in this snippet: function writeToFile(text, filename): filehandle = open(filename) foreach line in text: filehandle.write(line) filehandle.close() The […]
If the model is validating the data, shouldn’t it throw exceptions on bad input?
Reading this SO question it seems that throwing exceptions for validating user input is frowned upon.
When is a catch clause empty [duplicate]
This question already has answers here: Is it ever ok to have an empty catch statement? (15 answers) Closed 11 years ago. I saw lots of questions and explanations regarding empty catch clauses but I was never actually sure what “empty” means. Is a catch clause like this empty? It clearly isn’t empty for the […]
When is a catch clause empty [duplicate]
This question already has answers here: Is it ever ok to have an empty catch statement? (15 answers) Closed 11 years ago. I saw lots of questions and explanations regarding empty catch clauses but I was never actually sure what “empty” means. Is a catch clause like this empty? It clearly isn’t empty for the […]
Throwing an exception for errors that can be fixed
Say I have a class like this:
Throwing an exception for errors that can be fixed
Say I have a class like this:
Throwing an exception for errors that can be fixed
Say I have a class like this: