Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Produces a human readable stack trace
- *
- * @param stack
- * Unformatted Stack string from {exObject}.stack
- * @return {String}
- * Formatted stack string
- * @author John Brinkman
- * http://blogs.adobe.com/formfeed/2009/03/handling_javascript_exceptions.html
- * @remark extra infos
- * Piece of code extracted from pdf and reused in thunderbayes.googlecode.com
- * to generate a stack trace for auto reporting to the issue tracker
- */
- stackRead: function (stack) {
- "use strict";
- var vLineNumber, vParts, vFunctionName, vDetails, i, j, vLines, vStack = "";
- vLines = stack.split("\n");
- for (i = 0; i < vLines.length; i += 1) {
- if (vLines[i].length > 0) {
- vParts = vLines[i].split("@");
- vFunctionName = vParts[0];
- vDetails = vParts[1].split(":");
- vLineNumber = vDetails[vDetails.length - 1];
- if (vLineNumber !== "0") {
- vStack += "line: " + vLineNumber;
- if (vFunctionName.length > 0) {
- vStack += " of " + vFunctionName;
- }
- if (vDetails.length > 2) {
- vStack += " in the " + vDetails[vDetails.length - 2];
- // Construct a SOM expression of the host object
- for (j = 2; j < vDetails.length - 2; j += 1) {
- if (j > 2) {
- vStack += ".";
- }
- vStack += vDetails[j].replace("[0]", "");
- }
- }
- vStack += "\n";
- }
- }
- }
- return vStack;
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement