1. Ricardo Jasso
  2. PowerBuilder
  3. Tuesday, 26 March 2019 17:26 PM UTC

Hi,

Does anyone know how to dynamically obtain the name of an object function? This.ClassName() will return the name of the object, but not the function I'm working on.

I want to use the name of the function in error messages so I can easily locate the offending code.

Regards,

Ricardo

 

Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 26 March 2019 19:25 PM UTC
  2. PowerBuilder
  3. # 1

PopulateError will fill out the error object but not trigger a system error. You'll get the object, function/event, and the line number.

Comment
  1. Ricardo Jasso
  2. Tuesday, 26 March 2019 20:06 PM UTC
Thanks! That did the job.
  1. Helpful
There are no comments made yet.
Ferdinand Fischer Accepted Answer Pending Moderation
  1. Tuesday, 26 March 2019 18:34 PM UTC
  2. PowerBuilder
  3. # 2

Hi,

 

you can either throw and catch an exception or fill the error object ,if you only want to get the functionname.

I think filling the error object would be the simplest solution.

 

E.g

ls_error_src = f_debug(PopulateError(0,"Ipsem lorem.."))

string f_debug(long al_err)

return error.errorscript

You could of course return more information.

Regards,

Ferdinand

Comment
  1. Ricardo Jasso
  2. Tuesday, 26 March 2019 20:08 PM UTC
Yes, PopulateError fills the string variable ObjectEvent of the Error object. Thanks!
  1. Helpful
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.