views:

565

answers:

1

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?

try
// 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="%"
 else
  is_symv_no = ls_symv_no
  gstr_symv_passed_values.is_values[1]=""
 end if
catch (throwable err)
 is_symv_no="%"
end try
+2  A: 

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
Ian