Git Product home page Git Product logo

stackframe's People

Contributors

andersk avatar btd avatar caub avatar dependabot[bot] avatar eriwen avatar loopj avatar niftylettuce avatar oliversalzburg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stackframe's Issues

Any reason for choosing Unlicense over MIT?

I am just wondering what might be the reason of choosing Unlicense, in favour for example of MIT?

MIT would be clearer in the lawyers eyes, and even if the license would need to be changed later in to something else, the versions published with MIT are still valid as MIT.
This would not seem to be the case with Unlicense.

No matching version found for stackframe@^1.3.0

npm ERR! code ETARGET
npm ERR! notarget No matching version found for stackframe@^1.3.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'error-stack-parser'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-06-06T02_19_46_421Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Can't pull 1.1.1 from NPM

npm install fails with when trying to install cucumber js with is dependent on this package

npm ERR! code ETARGET
npm ERR! notarget No matching version found for stackframe@^1.1.1
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'stack-generator'
npm ERR! notarget

Doc for toString() does not match code

Expected Behavior

The toString() method is documented as outputting funcName(args)@fileName:lineNo:colNo. This should be the preferred format IMO.

Current Behavior

Code and output use funcName (fileName:lineNo:colNo), and args are not even used in the method.

Steps to Reproduce (for bugs)

Context

Your Environment

  • Package version:
  • Browser name and version:
  • OS version (desktop or mobile):
  • Link to your project:

Possible Solution

Implement the method to match the documentation.

Create a StackFrame from an object

When passing a StackFrame from my client to my server I json stringify it.
So from the server I'll like to be able to recreate the StackFrame just by assigning the object received.

{
    functionName: "WuiDom.eval",
    fileName: "src/views/LoginScreen/index.js",
    lineNumber: 233,
    columnNumber: 17,
    source: "    at WuiDom.eval (src/views/LoginScreen/index.js:233:17)"
}

syntax error (aka. simple errors) are not traced

Hello!

I started using stacktracejs on OpenProcessing, and realized that in cases where error is a simple error without error.stack (e.g. a syntax error), stacktracejs returns an empty trace array, although the exception itself actually includes the filename, linenumber, charnumber.

window.onerror = function (msg, url, lineNumber, columnNo, error) { //no error.trace, but stacktrace can use msg, url, lineNumber, columnNo to create a single element array. StackTrace.fromError(error) .then(function(stackArray){ //stackArray is empty }) .catch(function (err) { //doesnt come here either }); } }

proposed solution
if error.stack is not accessible, stacktrace can still return a single item array using msg, url, lineNumber, columnNo provided.

What do you think?

remove 'Number' from public property names

It is not a good practice to indicate a property type in it's name. If you want to specify it, JSDOC is much better place to do it.
I have been using stacktrace recently in conjunction with source-map from Mozilla and I had to remap stackframe objects to fit

{
  line: 2,
  column: 28
}

because that is a kind of object that they expect. I think it would make sense to unify the naming conventions in Mozilla's favour. What do you think @oliversalzburg ?

Available on CDN?

I was trying to find stackframe and error-stack-parser on a CDN somewhere, I found stacktrace on cdnjs but not the others. Have I missed them somewhere?

Add the raw traceline on the StackFrame

It would be useful for people to have the raw traceline in cases where the stack trace parser can't parse a line, or in cases that would be otherwise ambiguous (e.g. a line from "(native)" code vs something else that doesn't have a concrete location).

StackFrame changes has broken other components

As you transitioned to using object as the single parameter upon creation, 'error-stack-parser' now always create empty 'StackFrame' objects. It happens because parser still passes all the parameters as arguments to the StackFrame constructor. Seems like event last versions of parser are vulnerable to this issue.

For now, I patched my local StackFrame constructor like that:

if (functionName instanceof Object) {
            var obj = functionName;
            var props = booleanProps.concat(numericProps.concat(stringProps.concat(arrayProps)));
            for (var i = 0; i < props.length; i++) {
                if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {
                    this['set' + _capitalize(props[i])](obj[props[i]]);
                }
            }
        } else {
            if (functionName !== undefined) {
                this.setFunctionName(functionName);
            }
            if (args !== undefined) {
                this.setArgs(args);
            }
            if (fileName !== undefined) {
                this.setFileName(fileName);
            }
            if (lineNumber !== undefined) {
                this.setLineNumber(lineNumber);
            }
            if (columnNumber !== undefined) {
                this.setColumnNumber(columnNumber);
            }
            if (source !== undefined) {
                this.setSource(source);
            }
        }

It's a dirty hack, but it works. Please, fix all other parts as currently it is not functional.

No matching version found for stackframe@^1.3.0

npm version 5.6.0

npm ERR! code ETARGET
npm ERR! notarget No matching version found for stackframe@^1.3.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'error-stack-parser'

Add support for anonymous functions (eval)

Given an error stack like this one:

ReferenceError: a is not defined
    at $$.onStart (eval at <anonymous> (http://localhost:8080/hg/html/js/homegenie.webapp.js?version=r525:6851:25), <anonymous>:32:7)
    at $$.RenderWidget (http://localhost:8080/hg/html/js/homegenie.webapp.js?version=r525:6770:36)
    at $$.RenderView (http://localhost:8080/hg/html/js/homegenie.webapp.js?version=r525:6757:12)
    at http://localhost:8080/hg/html/js/homegenie.webapp.js?version=r525:6879:24
    at Object.$.ajax.success (http://localhost:8080/hg/html/js/homegenie.api.js?version=r525:724:21)
    at l (http://localhost:8080/hg/html/js/jquery-2.0.2.min.js:3:24881)
    at Object.c.fireWith [as resolveWith] (http://localhost:8080/hg/html/js/jquery-2.0.2.min.js:3:25702)
    at k (http://localhost:8080/hg/html/js/jquery-2.0.2.min.js:5:4919)
    at XMLHttpRequest.<anonymous> (http://localhost:8080/hg/html/js/jquery-2.0.2.min.js:5:8723)

stackframe will currently ignore the eval <anonymous>:32:7 at the end of the first stack element, which is the real source of the error at line 32, column 7.
It will indeed report stack[0] with line 6851 and column 25.

TypeError: StackFrame is not a constructor

ERROR TypeError: StackFrame is not a constructor
TypeError: StackFrame is not a constructor
at Object. (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/error-stack-parser/error-stack-parser.js:76:24)
at Array.map ()
at Object.ErrorStackParser$$parseV8OrIE [as parseV8OrIE] (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/error-stack-parser/error-stack-parser.js:56:29)
at Object.ErrorStackParser$$parse [as parse] (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/error-stack-parser/error-stack-parser.js:31:29)
at getOriginalErrorStack (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/@soda/friendly-errors-webpack-plugin/src/core/extractWebpackError.js:31:29)
at extractError (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/@soda/friendly-errors-webpack-plugin/src/core/extractWebpackError.js:22:20)
at Array.map ()
at processErrors (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/@soda/friendly-errors-webpack-plugin/src/core/transformErrors.js:31:17)
at FriendlyErrorsWebpackPlugin.displayErrors (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/@soda/friendly-errors-webpack-plugin/src/friendly-errors-plugin.js:97:29)
at doneFn (/home/work/jenkins/workspace/FX-BE_fenxi-analysis-front/node_modules/@soda/friendly-errors-webpack-plugin/src/friendly-errors-plugin.js:57:14)

Add dist to gitignore

When using np to publish this package, you can't because dist folder is not in the .gitignore file.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   dist/stackframe.js
	modified:   dist/stackframe.min.js
	modified:   dist/stackframe.min.js.map

TypeError: Line Number must be a Number

Hi! We are using this library as a dependency of redbox-react via error-stack-parser, and I noticed there’s a kind of Chome Error object that causes it to crash.

I started filing this in https://github.com/stacktracejs/stacktrace.js by mistake so here goes a nice template 😄 .

Expected Behavior

Given an error object with the following stack as reported by error.stack.toString():

ReferenceError: chilxdren is not defined
    at new Layout (webpack:///./src/Layout.js?:25:5)
    at eval (webpack:///../react-hot-loader/~/react-proxy/modules/createClassProxy.js?:90:24)
    at instantiate (webpack:///../react-hot-loader/~/react-proxy/modules/createClassProxy.js?:98:9)
    at Layout (eval at proxyClass (webpack:///../react-hot-loader/~/react-proxy/modules/createClassProxy.js?), <anonymous>:4:17)
    at ReactCompositeComponentMixin.mountComponent (webpack:///./~/react/lib/ReactCompositeComponent.js?:170:18)
    at wrapper [as mountComponent] (webpack:///./~/react/lib/ReactPerf.js?:66:21)
    at Object.ReactReconciler.mountComponent (webpack:///./~/react/lib/ReactReconciler.js?:39:35)
    at ReactCompositeComponentMixin.performInitialMount (webpack:///./~/react/lib/ReactCompositeComponent.js?:289:34)
    at ReactCompositeComponentMixin.mountComponent (webpack:///./~/react/lib/ReactCompositeComponent.js?:237:21)
    at wrapper [as mountComponent] (webpack:///./~/react/lib/ReactPerf.js?:66:21)

It should parse all lines correctly and should not crash.

Current Behavior

It crashes with TypeError: Line Number must be a Number while handling this particular line:

    at Layout (eval at proxyClass (webpack:///../react-hot-loader/~/react-proxy/modules/createClassProxy.js?), <anonymous>:4:17)

As you can see, it has multiple entries separated by comma—presumably because the error was caught and rethrown, although I haven’t looked at why closely. The first item doesn’t have the line number info for some reason, but stacktrace.js assumes that it is always there. This makes it parse the location info incorrectly and throw later:

screen shot 2016-04-19 at 01 18 01

screen shot 2016-04-19 at 01 18 41

## Steps to Reproduce (for bugs)

This is a very tricky one because I’m debugging a dev version of the project which involves compiling several libraries. If you trust me I’m not making this up, you can parse the stack string I documented above to reproduce the issue. 😄

Context

I noticed this working on React Hot Loader 3 that will rely on error boundaries in React to handle errors as you edit the code, fix them without reloading the app.

I noticed that in some cases the error box failed to appear, and tracked it down to this dependency.

Your Environment

  • stackframe version: 0.3.1
  • Browser Name and version: Chrome 49.0.2623.112 (64-bit)
  • Operating System and version (desktop or mobile): OS X 10.11 (15A279b)
  • Link to your project: https://github.com/KeywordBrain/redbox-react

Possible Solution

Be more resilient to parsing errors and check the line number for being a number during parsing, use 0 otherwise.

Version accident

Updates are very fast. ERROR TypeError: StackFrame is not a constructor was reported two hours ago. The version is 1.3.1, now 1.3.4 is no problem, it took me a lot of time to troubleshoot errors
😂😂

Confusing property/get/set API

Expected Behavior

For the StackFrame object, I would expect a very simple way to get and set properties:

  • Just access stackframe.filename to read the property
  • Set the property via stackframe.filename = "myfile.js"

That should be the API regardless of whether or not it is implemented as a getter/setter pair. If there is extra work to do for either, then a getter/setter pair should be used with a hidden property like stackframe._filename, which the user should not be instructed to access directly.

Current Behavior

The current API is confusing and does not make use of actual JS getters and setters. For example:

  • What happens if I set the property directly? Is that the same as the set method?
  • What's different about accessing the property vs. the get method? Both are used in the documentation with no explanation.

Furthermore, the typings for the set methods have zero parameters defined.

Represent inner eval locations

A StackFrame can actually have a file location and a location within an eval() call.

For example, this stack:

Error: message string
    at baz (eval at foo (eval at speak (http://localhost:8000/test/functional/testeval.html:26:22)), <anonymous>:1:30)
    at foo (eval at speak (http://localhost:8000/test/functional/testeval.html:26:22), <anonymous>:2:96)
    at eval (eval at speak (http://localhost:8000/test/functional/testeval.html:26:22), <anonymous>:4:18)
    at Object.speak (http://localhost:8000/test/functional/testeval.html:26:17)
    at http://localhost:8000/test/functional/testeval.html:33:13

Notice the locations within the eval'd code, represented by , <anonymous>:2:96). We may want to represent this using a parent/child relationship.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.