Quantcast

Getting source maps to provide nice error messages?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Getting source maps to provide nice error messages?

colind
Hello,
I was hoping to use source maps to help make better error messages on minified builds, but it is still getting mangled names in the error messages

For example, if I take the dojo boilerplate (https://github.com/csnover/dojo-boilerplate) and patch it to throw an error

diff --git a/src/app/Dialog.js b/src/app/Dialog.js
index 4e69a7d..6653794 100644
--- a/src/app/Dialog.js
+++ b/src/app/Dialog.js
@@ -3,6 +3,7 @@
  * class that extends a dijit Dialog and overrides the default title and content properties.
  */
 define([ 'dojo/_base/declare', 'dijit/Dialog' ], function (declare, Dialog) {
+    throw Error('hello world');
        return declare(Dialog, {
                title: 'Hello World',
                content: 'Loaded successfully!'

Then the error message is 

main.js.uncompressed.js:8 Uncaught Error: hello world
    at main.js.uncompressed.js:8
    at ha (dojo.js.uncompressed.js:1134)
    at ha (dojo.js.uncompressed.js:1253)
    at ha (dojo.js.uncompressed.js:1253)
    at dojo.js.uncompressed.js:1297
    at ga (dojo.js.uncompressed.js:1277)
    at V (dojo.js.uncompressed.js:1292)
    at d (dojo.js.uncompressed.js:1458)
    at HTMLScriptElement.<anonymous> (dojo.js.uncompressed.js:1707)

I was hoping that the function names would be unmangled in this case

I'm pretty certain the source map is loaded though, as it is referring to line numbers in the dojo.js.uncompressed.js but dojo.js for running (even though map file doesn't load in chrome network tab) http://stackoverflow.com/questions/31524221/source-map-is-not-visible-at-chrome-network-tab

Thanks

-Colin

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting source maps to provide nice error messages?

dylanks
Are you sure these are actually not the real variable names used
internally in this case? I know parts of code intentionally use rather
short variable names (it was part of an earlier effort to make core
pieces of Dojo as small as possible, though in hindsight it made parts
of Dojo much less legible), and I thought the optimized variable names
were more cryptic than those shown in your error message?

Regards,
-Dylan

on 3/15/17, 15:33 (GMT-07:00) Colin said the following:

> Hello,
> I was hoping to use source maps to help make better error messages on
> minified builds, but it is still getting mangled names in the error messages
>
> For example, if I take the dojo boilerplate
> (https://github.com/csnover/dojo-boilerplate) and patch it to throw an error
>
> diff --git a/src/app/Dialog.js b/src/app/Dialog.js
> index 4e69a7d..6653794 100644
> --- a/src/app/Dialog.js
> +++ b/src/app/Dialog.js
> @@ -3,6 +3,7 @@
>   * class that extends a dijit Dialog and overrides the default title
> and content properties.
>   */
>  define([ 'dojo/_base/declare', 'dijit/Dialog' ], function (declare,
> Dialog) {
> +    throw Error('hello world');
>         return declare(Dialog, {
>                 title: 'Hello World',
>                 content: 'Loaded successfully!'
>
> Then the error message is
>
> main.js.uncompressed.js:8 Uncaught Error: hello world
>     at main.js.uncompressed.js:8
>     at ha (dojo.js.uncompressed.js:1134)
>     at ha (dojo.js.uncompressed.js:1253)
>     at ha (dojo.js.uncompressed.js:1253)
>     at dojo.js.uncompressed.js:1297
>     at ga (dojo.js.uncompressed.js:1277)
>     at V (dojo.js.uncompressed.js:1292)
>     at d (dojo.js.uncompressed.js:1458)
>     at HTMLScriptElement.<anonymous> (dojo.js.uncompressed.js:1707)
>
> I was hoping that the function names would be unmangled in this case
>
> I'm pretty certain the source map is loaded though, as it is referring
> to line numbers in the dojo.js.uncompressed.js but dojo.js for running
> (even though map file doesn't load in chrome network
> tab) http://stackoverflow.com/questions/31524221/source-map-is-not-visible-at-chrome-network-tab
>
> Thanks
>
> -Colin
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting source maps to provide nice error messages?

colind
I believe they are definitely the minified function names (most of the stack trace refers to function not variable names), and it affects a lot of source code of my app as well so not just dojo :).

This is the stack trace without minifying the dojo-boilerplate example above. It is not a very deep stack trace on the app side but even on the dojo side it has the function names added at least!

Error: hello world
    at Dialog.js:6
    at runFactory (dojo.js:1134)
    at execModule (dojo.js:1262)
    at execModule (dojo.js:1253)
    at execModule (dojo.js:1253)
    at dojo.js:1297
    at guardCheckComplete (dojo.js:1277)
    at checkComplete (dojo.js:1292)
    at onLoad (dojo.js:1347)
    at Array.finish (text.js:189) "Error: hello world
    at guardCheckComplete (http://localhost:8000/dojo/dojo.js:1277:5)

-Colin

On Mon, Mar 20, 2017 at 2:45 AM, Dylan Schiemann <[hidden email]> wrote:
Are you sure these are actually not the real variable names used
internally in this case? I know parts of code intentionally use rather
short variable names (it was part of an earlier effort to make core
pieces of Dojo as small as possible, though in hindsight it made parts
of Dojo much less legible), and I thought the optimized variable names
were more cryptic than those shown in your error message?

Regards,
-Dylan

on 3/15/17, 15:33 (GMT-07:00) Colin said the following:
> Hello,
> I was hoping to use source maps to help make better error messages on
> minified builds, but it is still getting mangled names in the error messages
>
> For example, if I take the dojo boilerplate
> (https://github.com/csnover/dojo-boilerplate) and patch it to throw an error
>
> diff --git a/src/app/Dialog.js b/src/app/Dialog.js
> index 4e69a7d..6653794 100644
> --- a/src/app/Dialog.js
> +++ b/src/app/Dialog.js
> @@ -3,6 +3,7 @@
>   * class that extends a dijit Dialog and overrides the default title
> and content properties.
>   */
>  define([ 'dojo/_base/declare', 'dijit/Dialog' ], function (declare,
> Dialog) {
> +    throw Error('hello world');
>         return declare(Dialog, {
>                 title: 'Hello World',
>                 content: 'Loaded successfully!'
>
> Then the error message is
>
> main.js.uncompressed.js:8 Uncaught Error: hello world
>     at main.js.uncompressed.js:8
>     at ha (dojo.js.uncompressed.js:1134)
>     at ha (dojo.js.uncompressed.js:1253)
>     at ha (dojo.js.uncompressed.js:1253)
>     at dojo.js.uncompressed.js:1297
>     at ga (dojo.js.uncompressed.js:1277)
>     at V (dojo.js.uncompressed.js:1292)
>     at d (dojo.js.uncompressed.js:1458)
>     at HTMLScriptElement.<anonymous> (dojo.js.uncompressed.js:1707)
>
> I was hoping that the function names would be unmangled in this case
>
> I'm pretty certain the source map is loaded though, as it is referring
> to line numbers in the dojo.js.uncompressed.js but dojo.js for running
> (even though map file doesn't load in chrome network
> tab) http://stackoverflow.com/questions/31524221/source-map-is-not-visible-at-chrome-network-tab
>
> Thanks
>
> -Colin
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...