3
In my try-catch
, I want to record the exception that occurred within an object (for historical effect, necessary for the business rule, since this section takes place in a processing via integration with external sources).
For that, I need to make sure catch
that the exception was not from database or from my ORM, because if it would not give an exception within the exception... it would be a crash ugly and bam, system out of breath.
So that would be about it:
Try {
//Cógido
}
catch (exception ex)
{
//VERIFICAR SE NÃO É UMA EXCEÇÃO DE BD (MEU CASO ENTITY FRAMEWORK)
}
Is there such a possibility? How could I do this in a more general way possible?
Ball show @bigown. I already use Elmah. This case there was very specific and only to record processing effects (or defects) during integration. For history. It looks ugly but it was super conscious.
– Bruno Heringer
Important to remember that the
is
checks the entire inheritance structure of the object.– Jéf Bueno
@jbueno but the intention to filter is just to get the whole hierarchy. I just missed the second example because I copied and pasted and forgot to take the
is
that no longer fits there :) Tidy.– Maniero