Patryk B.
2008-08-06 08:00:39 UTC
Hello,
I have question about situation when i should throw exception.
For example i have some function that work with some text file,
function read some data and analyze it. Let's say that in that file should
only by digits but the functions encouter letter (somone who wrote that
file made a mistake and pressed wrong key). So in that situation I should
throw a exception or maybe just "return false"(or other value)? I know that
I can do both, but which method is better, which one is use frequently,
which one is compatible which modern programming style.
Thanks,
Patryk B.
I have question about situation when i should throw exception.
For example i have some function that work with some text file,
function read some data and analyze it. Let's say that in that file should
only by digits but the functions encouter letter (somone who wrote that
file made a mistake and pressed wrong key). So in that situation I should
throw a exception or maybe just "return false"(or other value)? I know that
I can do both, but which method is better, which one is use frequently,
which one is compatible which modern programming style.
Thanks,
Patryk B.