rapydscript-ng icon indicating copy to clipboard operation
rapydscript-ng copied to clipboard

What is the easiest way to debug an error on RS?

Open rafi16jan opened this issue 5 years ago • 4 comments

Hey Kovid, it's been years since I've been developing with RapydScript and it really helps me in many things. Thanks for your work. Just one quick question, what's the best way to debug RapydScript errors? Especially the runtime errors not the compilation error (since the compiler points the direct code). Because first the javascript itself doesn't print the exact code line if the error is from a Promise, and then after searching for the code that cause the error with catch, it's a transpiled javascript which is harder to read for beginners (especially one who haven't know javascript or even new ES6 javascript developers can't seem to understand too). Because this bugs us a lot. It's actually not a problem for me but my colleagues depends on me in debugging the errors, I'm a bit confused about were they the one that weren't smart enough or I that was forcing them to use RS was silly.

This is actually a personal issue but I want to clear them up, do you have any suggestion? Maybe should I integrate RS to webpack? Or is it easy to add map files to RS?

rafi16jan avatar Feb 16 '19 13:02 rafi16jan

Personally, I have no problems reading the transpiled JS that RS produces, so I have no motivation to implemnt map files. But certainly in principle they could be implemented. But it is going to require work from someone other than me, i'm afrad.

kovidgoyal avatar Feb 16 '19 18:02 kovidgoyal

@kovidgoyal me too, but not everyone are able to read it that easy. Can you give me some instruction or references to make source map files?

rafi16jan avatar Feb 17 '19 01:02 rafi16jan

I came accross this: https://github.com/mozilla/source-map

Turnout its not that easy to make source maps. Either you have to read the ast per line, or you pin point the compiled and original code line and column yourself...

rafi16jan avatar Feb 17 '19 02:02 rafi16jan

All ast elements in RS contain line and column information for use in error messages, should not be hard to translate that into map files.

kovidgoyal avatar Feb 17 '19 06:02 kovidgoyal