rhaiscript / rhai

Rhai - An embedded scripting language for Rust.
https://crates.io/crates/rhai
Apache License 2.0
3.79k stars 177 forks source link

Return better error messages #1

Closed sophiajt closed 4 years ago

sophiajt commented 8 years ago

Currently, Rhai doesn't track source positions so errors have no location information. Additionally, it doesn't track the names of where errors occurred (eg: Variable not found vs Variable 'a' not found).

juanibiapina commented 6 years ago

Also many errors are returned as Function not found, including some type errors.

luciusmagn commented 6 years ago

That's true, it is currently a limitation of our current design. We have polymorphism by just defining more functions registered with the same name to the Rhai engine. Therefore, if a type is wrong, we just assume that the proper variant doesn't exist

stevedonovan commented 6 years ago

It certainly would be useful if the error would specify the types for which the function could not be resolved.

On Wed, Jun 13, 2018 at 11:01 AM, Lukáš Hozda [magnusi] < notifications@github.com> wrote:

That's true, it is currently a limitation of our current design. We have polymorphism by just defining more functions registered with the same name to the Rhai engine. Therefore, if a type is wrong, we just assume that the proper variant doesn't exist

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jonathandturner/rhai/issues/1#issuecomment-396867291, or mute the thread https://github.com/notifications/unsubscribe-auth/AANXDXwTNBIM7_PEnC7l-qbqCdm5n-A2ks5t8NT0gaJpZM4HpXbv .

schungx commented 4 years ago

PR https://github.com/jonathandturner/rhai/pull/98 now has pretty comprehensive error reporting. For most uses it should be enough unless we are dealing with very complicated, very large scripts...

Closing for now.