Hi Gang,

Using Lucee 5.4.latest

In our code we have the following;

				'transferModel.cfc problem - #createObject("java", "").localhost.getCanonicalHostName()#',
				'Hi there,' & Chr(10) & Chr(13) & Chr(10) & Chr(13) &
				'#GetCurrentTemplatePath()# #getPageContext().getCurrentLineNo()#' & Chr(10) & Chr(13) & Chr(10) & Chr(13) &
				'Something missing from passedStruct.' & Chr(10) & Chr(13)

I have never seem this portion of our code executed;
In that I have never received an error email that with those contents.
But at some stage - It obviously did work.

Nonethless, I received an Error Email overnight, complaining that the method;

does not exist.

I have dumped the PageContext object and sure enough - it does not exist.
Which is fine.
(Perhaps the original code is from using ACF or Railo - I have no idea)

Some google-fu, found this link

Which I might be able to hack up to give me just the current line number without the whole stack trace.
But before I went down that path - I thought I would ask if anyone knew of a CFML BIF that I might use as simply as the original code getPageContext().getCurrentLineNo()

As Always thanks!

Here’s what I use in my error handler:



This might be overkill, but i use CallStackGet() when app is in debugging mode to create a full stack trace:

trace = CallStackGet();
myTrace = arrayNew(1);
for (i = 1; i Lte arrayLen(trace); i = i + 1) {
info = {};
info[“Template”] = trace[i].template;
info[“Function”] = trace[i].function;
info[“LineNumber”] = trace[i].LineNumber;
arrayAppend(myTrace, duplicate(info));

I find it very handy to convert array to text and append it after sql statements as a comment /* */ so i can see exactly where arbitrary sql queries are being executed from in code.

1 Like