I work in a code base (C # 3.5), which is dotted with exception handling blocks that return true / false when internally in a function that returns 'bool'.
catch (Exception ex) { return false; }
This is the wrong practice. I am thinking of registering an exception and having a local variable (for a function) that will be initialized. And this variable will be returned at the end of the function.
What do you think?
The usual accepted way to handle exceptions is to handle them only if you can do something with it . Of course, you can handle the general exception only for magazines, but after that you have to re-raise.
. , , , ...
catch , .
, - .
catchall, ( ).
, .
C, true/false . # .
, , , . .
, . , (, ), , . , dbase, .
, . , , try/catch, . AppDomain.UnhandledException, , , . , , . , , , , .
, , , !
bool , , .
, false - , , , .
, , .
Source: https://habr.com/ru/post/1731982/More articles:You need to understand how the manifest is created for a C ++ program - c ++To send an iPhone application to the application store, do we need our own server in all cases? - iphoneHow to implement administrator rights in a Java application? - javaGet font from given font name - c #Ajax Download using valums plugin to load ajax inside a form - filehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1731983/where-can-i-find-a-map-from-font-font-face-names-to-filenames&usg=ALkJrhhS2O1j0Hnd4FVrefbzbccjZPb7PgHow to save the image in the file system of the iPhone device, so that later, if I want, I can get it and use it in my application? - objective-cHow to generate an XML file using Ruby and Builder :: XMLMarkup Templates? - ruby โโ| fooobar.comWhat is the difference between glClient *** gl ***? - opengl-esWhy is my wxPerl application for Windows not starting? - windowsAll Articles