What error checking are you doing? What error checking is really necessary? Do we really need to check if the file was saved successfully? Doesn't it always work if it is tested and works fine from day one?
I found an error in checking every little thing, and most of the time if I feel an excessive reaction. Things like checking to check if the file was written to the file system successfully, checking if the database instruction worked ... should this work or not?
How many error checks do you make? Are there error checking elements that you do not account for because you trust that it will work?
I am sure that I remember somewhere reading something like the lines โdo not check things that will never happenโ ..... I canโt remember the source.
So, should everything that might be possible be tested for failure? Or should we just trust these simpler operations? For example, if we can open a file, we need to check if each line was read or not? Perhaps this depends on the context within the application or the application itself.
It would be interesting to hear what others are doing.
UPDATE: As a quick example. I save an object representing the image in the gallery. Then I save the image to disk. If saving the file fails, I will have to display the image, even if the object believes that there is an image. I can check if it was not possible to save the image to disk, and then delete the object or, conversely, wrap the image in a transaction (unit of work), but this can become expensive when using the db engine using table locking.
Thanks,
James.
error-checking
James
source share