Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error Management
#4
If the error is generated in a function that is being called by another function/macro the str functionname.getmacro(_error.iid 1) line is the name of the calling function in my LogErrors script when an error is generated by ErrDescrAndLine function.

What would be the best mod to get the function name actually generating the error?

Function LogErrors
Code:
Copy      Help
str CSV TimeStamp.timeformat("{yyyyy}{MM}{dd}T{HH}{mm}{ss}Z")
str macroname.getmacro(getopt(itemid 3) 1)
str pattern="(.*) // (.*)"
ARRAY(str) ERROR

if(_error.source) ;;macro ended due to an error
,str functionname.getmacro(_error.iid 1)
,out functionname
,out macroname
,if(findrx(_error.description pattern 0 0 ERROR)<0)
,,ERROR[]=""
,,ERROR[]=_error.description
,,ERROR[]=_error.line
,ERROR[1].findreplace("Failed.")
,ERROR[1].trim
,ERROR[2].findreplace("[9]")
,CSV=F"{TimeStamp}[9]Failed[9]{macroname}[9]{functionname}[9]{ERROR[1]}[9]{ERROR[2]}"
else
,CSV=F"{TimeStamp}[9]Success[9]{macroname}[9][9]"

LogFile(CSV 0 "$desktop$\errorlog.csv")


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)