Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Identifying the source of an error in a try block

    I was wondering if there was anyway to do this. I have a try block that's like 300 lines long, and I keep getting stringindexoutofbounds errors, and I can't find where they're coming from.

    I can identify the type of the error in the catch block by printing the exception, I just can't figure out where its from...

    thanks

  • #2
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    if you use the printStackTrace method when you catch the exception, it will usually give you a line number.

    Something like:

    PHP Code:
    try
    {
        
    //code that errors here
    }
    catch (
    Exception e)
    {
        
    e.printStackTrace();


  • #3
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    and there it is. Thanks, that worked perfectly


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •