Clearing errors

Posts   
 
    
Stoop
User
Posts: 66
Joined: 28-Feb-2004
# Posted on: 16-Mar-2004 11:45:46   

Hi

I've implemented an Error log in SQL where trappable errors are recorded. However, I ran into a situation where I'm not sure what to do. Basically I have this in a nutshell:

(the Company object is created & populated in other part of code..)

Try

'Company email has length of 20 in SQL. 'Generate error on purpose Company.CompanyEmail = "shshshhsdhsdhhsdhsdhhhds@mycom.com"

Catch ex As System.Exception

dim ErrorObject as New ErrorEntity Dim adapter As DataAccessAdapter = New DataAccessAdapter 'Set one properties ErrorObject.ErrorMessage = ex.Message ErrorObject.ErrorTime = System.DateTime.Now() 'Save to db Me.adapter.SaveEntity(ErrorObject)

End Try

OK - what happens is, of course, the SSLgen classes catch the error as a System.ArgumentOutOfRangeException in the SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ValidateValue method

The problem is that now I can't use the ErrorEntity to write the error to the db. Stepping through the code just "skips" right over it. I need a way to "Clear" or set the validation back to true so I can save the error info to the db..

Thanks

Stoop
User
Posts: 66
Joined: 28-Feb-2004
# Posted on: 16-Mar-2004 11:56:48   

PS I well aware that good business rules (which I have implemented) would catch this BEFORE anthing happens.

However, I want to know the answer to this question because after development & testing, once an app goes live, we all know that users come up with ways we never thought of to break code (especially in an ASP.NET app).

I want this ability so I can log any of my any faulty business logic (without being a show stopper to the user) once this goes live and real users are using the app in real life.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 16-Mar-2004 22:46:15   

I might miss something, but why isn't the errorentity object saved into the db? Does it crash on the SaveEntity(errorObject) method?

Frans Bouma | Lead developer LLBLGen Pro
Stoop
User
Posts: 66
Joined: 28-Feb-2004
# Posted on: 17-Mar-2004 10:55:27   

Hi

Problem resolved!! No problems with LLGen code.... simple_smile

Steve

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 17-Mar-2004 11:15:33   

Ok! simple_smile

Frans Bouma | Lead developer LLBLGen Pro