1. Sanjay Shivade
  2. PowerBuilder
  3. Friday, 11 January 2019 21:38 PM UTC

Hi,

I am in the process of evaluating migration of our PB 9.0.2 code to PB 2017 version of yours. My 4K lines of code have weird issue with Try and Catch. As per Migration assistant the details are as follows. Could you review the code and point us in the right direction? Syntactically it's matching with your 2017 Help file so I feel this might be product defect. I will really appreciate your help. 

 

Lines: 

try

end try

public function integer getinboxcount ();try

Searchfun

try

replacefun

New Reserved Syntax

The code of one of the functions having this issue is as follows for your reference:

is_featureobjectname = Message.StringParm

TRY

n_crystalreport_exception ln_crystalreport_exception
ln_crystalreport_exception = CREATE n_crystalreport_exception

If IsNull(is_featureobjectname ) or pos(lower(trim(is_featureobjectname)),".rpt") < 1 Then
ln_crystalreport_exception.setMessage("Invalid Feature ObjectName")
throw ln_crystalreport_exception
End If

in_crystalreport_base.getCrystalReport(is_featureobjectname)

CATCH (n_crystalreport_exception ne)
MessageBox("Crystal Report Exception", ne.getMessage(), StopSign!)
return false
END TRY

return true

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 18 January 2019 02:40 AM UTC
  2. PowerBuilder
  3. # 1

Just saying: Just ignore the TRY..CATCH error.

The fact that Try Catch will be simply ignored when running on powerserver does not mean there's nothing to worry about.

I have several Catch statements which I really want to do something when the try fails, so I've had to do workarounds for those.

my 2cts.

Comment
  1. Sanjay Shivade
  2. Friday, 18 January 2019 16:31 PM UTC
I will do so. Thanks
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 19:32 PM UTC
  2. PowerBuilder
  3. # 2

Hi Sanjay;

    Yes, the Migration Assistant has a"bug" in it when it comes to the TRY..CATCH statements. This command should not be flagged. Here is what it did on my Test App ...

However, the App migrated and ran OK. Just ignore the TRY..CATCH error.

Note: You would get errors when migrating your PB App to PowerServer as the TRY..CATCH is not supported in PowerServer Web/Mobile applications. This would be reported in the PS Code Analysis report.

HTH

Regards ... Chris

Comment
  1. Sanjay Shivade
  2. Friday, 18 January 2019 16:31 PM UTC
Thanks. I will ignore TRY..CATCH statements..
  1. Helpful
There are no comments made yet.
Sanjay Shivade Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 06:13 AM UTC
  2. PowerBuilder
  3. # 3

As I recall, it took 20 minutes to migrate all targets but resulted in 3000 lines of code having issues with try and catch.

 

 

Comment
There are no comments made yet.
Sanjay Shivade Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 05:57 AM UTC
  2. PowerBuilder
  3. # 4

As per migration assistant:

 

Searchfun

try

replacefun

New Reserved Syntax

 

However I do not see any issue with the try catch implementation. What could be the problem? Thanks!

 

Comment
There are no comments made yet.
Sanjay Shivade Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 04:42 AM UTC
  2. PowerBuilder
  3. # 5

Yes the migration assistant is the one which says 'New Reserved Syntax' for Try-Catch. Am I confused here?

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Sunday, 13 January 2019 14:46 PM UTC
  2. PowerBuilder
  3. # 6

Have you tried migrating the code?

Comment
There are no comments made yet.
Sanjay Shivade Accepted Answer Pending Moderation
  1. Friday, 11 January 2019 21:41 PM UTC
  2. PowerBuilder
  3. # 7

Another example with (Runtimerror ex)

TRY

io_wfxsession.rowcount = theGlobals.il_NumberOfItemsLimit

io_wfxinbox = io_wfxsession.Agenda(4)
il_Inboxcount = io_wfxinbox.count

return il_Inboxcount

CATCH (runtimeerror re)
ib_LinkFailure = TRUE
RETURN 0
END TRY

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.