Link to home
Create AccountLog in
Avatar of shieldguy
shieldguyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to read only the error line number from exception

In asp.net i am trying to read only error message after i caught exception,
how can I do it

I would realy appreciate any examples

Thanks
Try 
 .....
 .....
 .....        
 
  Catch ex As Exception
 
                'ADDING THE MORE MEANINGFUL INFORMATION TO EXCEPTION
                'BUT ONLY ADD NEW EXCEPTION THEIR IS NOT ALREADY ANY DETAIL ADDED BEFORE
                If ex.Data("Class") Is Nothing Then
                    ex.Data.Clear()
                    ex.Data("Class") = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString()
                    ex.Data("Function") = System.Reflection.MethodBase.GetCurrentMethod().Name
                End If
 
                'THROWING THE EXCEPTION AGAIN SO IT WILL BE CATCH AT THE HIGHER LEVEL
                Throw ex
 
            End Try

Open in new window

Avatar of Limbeck
Limbeck

hi, as in

ex.Message   ?
Avatar of shieldguy

ASKER

no just a error line no?
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer