getStackTrace()
Last updated January 26, 2004
Version: 1 | Requires: ColdFusion MX | Library: UtilityLib
Description:
Gets the current stack trace, even if no error was thrown, and returns it in a query.
Return Values:
Returns a query.
Example:
Parameters:
No arguments.
Full UDF Source:
<cfscript>
/**
* Gets the current stack trace, even if no error was thrown, and returns it in a query.
*
* @return Returns a query.
* @author Ivo D. SIlva (aphex@netvisao.pt)
* @version 1, January 26, 2004
*/
function getStackTrace() {
var j = "";
var i = "";
var e = "";
var StackTrace = "";
try
{
j = CreateObject("java","java.lang.Throwable");
j = j.getStackTrace();
StackTrace = QueryNew("ClassName,MethodName,NativeMethod,LineNumber,hashCode");
QueryAddRow(StackTrace,ArrayLen(j));
for (i=1; i le ArrayLen(j); i = i+1)
{
QuerySetCell(StackTrace,'ClassName',j[i].getClassName(),i);
QuerySetCell(StackTrace,'MethodName',j[i].getMethodName(),i);
QuerySetCell(StackTrace,'NativeMethod',j[i].isNativeMethod(),i);
QuerySetCell(StackTrace,'LineNumber',j[i].getLineNumber(),i);
QuerySetCell(StackTrace,'hashCode',j[i].hashCode(),i);
}
}
catch ( any e )
{
return e;
}
return StackTrace;
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
3 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)