com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
758 stars 117 forks source link

Uncaught error in fastopt.js #121

Closed gurghet closed 8 years ago

gurghet commented 8 years ago

In fastopt there is the following function defined

$c_Lscalatags_generic_Util$ExtendedString.prototype.attr__Lscalatags_generic_Attr = (function() {
    if ((!$m_Lscalatags_Escaping$().validAttrName__T__Z(this.s$1)) ) {
        throw new $c_jl_IllegalArgumentException().init___T(new $c_s_StringContext().init___sc_Seq(new $c_sjs_js_WrappedArray().init___sjs_js_Array(["Illegal attribute name: ", " is not a valid XML attribute name"])).s__sc_Seq__T(new $c_sjs_js_WrappedArray().init___sjs_js_Array([this.s$1])))
    }
    ;
    return new $c_Lscalatags_generic_Attr().init___T(this.s$1)
}
);

Unfortunately I cannot understend what the scope is supposed to be. The fact is that the IllegalArgumentException is not caught anywere. This caused me a lengthy session of debugging. Who is responsible for catching these exceptions? Scalatags or scalajs?

stewSquared commented 8 years ago

@gurghet This a scala-js thing. If you debug with chrome, you can use source maps.

stewSquared commented 8 years ago

@gurghet Could you ask this in the scala-js gitter? I think this issue can be closed because it's not really about scalatags.

gurghet commented 8 years ago

I'm pretty sure it's scalatags, I found the method. It's used 333 times throughout the library, it's not caught somewhere. I'm searching where right now.

gurghet commented 8 years ago

Ok sorry, it was my own code not catching it -.- I didn't expect it to be thrown directly. I feel it could be done differently, but at this point it's hard to suggest a better design.