Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

When in debug mode, powerbuilder (ver 10.5) throws application execution error and terminates the application, for errors raised by statements put inside try/catch blocks?

For example line 3 below throws, an "array boundary exceeded" error and the application is terminated. How can I overcome this (handled) error and debug the rest of the code?

// lstr_passed_values = message.powerobjectparm ls_symv_no = gstr_symv_passed_values.is_values[1] if isnull(ls_symv_no) or ls_symv_no = "" then is_symv_no="%" is_symv_no = ls_symv_no gstr_symv_passed_values.is_values[1]="" end if catch (throwable err) is_symv_no="%" end try Yes, this would solve the problem, but what's the purpose of a try/catch block. In runtime the code behaves ok, as expected, but in debug mode it behaves as if the try/catch statements are ignored ! gd047 Feb 11, 2010 at 8:54 After some research it seems that this is known problem and I'm not sure a generic workaround exists (outside of using messageboxes at runtime). groups.google.co.za/group/… ilitirit Feb 11, 2010 at 15:11

Struggling with debug?

I would say the PB Debugger is behaving as it should. If you try to really grasp the concept of debugging, it's suppose to step through your code line by line. By giving you an "Array boundary exceeded" error, the debugger has actually proven that there's a potential unhandled exception in your code (which is why you placed the Try-Catch code there).

It's not suppose to Throw the exception until the Debugger has actually reached that point. This defeats the purpose of a debugger. Do you get what I mean?

Now if you want to skip a particular code block while on debug mode, you need to use "Set Next Statement".

From your modified sample code below, set the breakpoint on Line 1. Once the debugger reaches the breakpoint, right-click "Edit Variable" the string "is_symv_no". Then move the point cursor on Line 14 and click "Set Next Statement". That will bypass the whole try-catch routine (Lines 2-13) and allow your program to continue.

1   ls_symv_no = ""
2   try 
3       // lstr_passed_values = message.powerobjectparm 
4       ls_symv_no = gstr_symv_passed_values.is_values[1] 
5       if isnull(ls_symv_no) or ls_symv_no = "" then 
6           is_symv_no="%" 
7       else 
8           is_symv_no = ls_symv_no 
9           gstr_symv_passed_values.is_values[1]="" 
10      end if 
11  catch (throwable err) 
12      is_symv_no="%" 
13  end try 
14  return
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.