Offer the less-verbose error message in prql-js
This is best described by @jiripospisil in https://github.com/prql/prql-code/pull/3
I think this is mostly a bindings question; how much of our Error type do we expose?
@charlie-sanders you've done much of the work there; if this might be something you might be interested in doing!
Well we're coming back around to something @aljazerzen said that eventually we might want to expose the full error object instead of just a message, which I think was the way it was originally. We could go back to not throwing any errors and just return a CompileResult ala:
#[wasm_bindgen]
#[derive(Default)]
pub struct CompileResult {
sql: Option<String>,
error: Option<CompileError>,
}
Or we can just throw a textual error message instead of the highlighting, what do you think ?
Wait sorry, the compile() method already returns the CompileResult, yeah let me take out the formatting for the to_sql exception message :+1:
Yes, there is, but it only exposes message, which is the pretty-formatted output with source code.
I've just changed how error.rs works and also exposed line, which can be just the error line, without the annotated source code.
Can you take a look and check if it works? I haven't tested much, so things like Playground may be broken...
Here: #1005
Shall we close this? (Or do we need an addition to prql-js?)
CC @jiripospisil (no action needed unless you want to add this to prql-code, no obligation, 🙏 )
@max-sixty Looks like everything necessary is in place. Have a look at https://github.com/prql/prql-code/pull/9.
Wonderful, I'll close this