Giter VIP home page Giter VIP logo

Comments (4)

udoprog avatar udoprog commented on August 23, 2024 1

To convert an error into one which is more descriptive you use the associated emit methods. If you want to capture it into a string, you can use a buffer like what's being done in rune-wasm here:

https://github.com/rune-rs/rune/blob/main/crates/rune-wasm/src/lib.rs#L269

https://github.com/rune-rs/rune/blob/main/crates/rune-wasm/src/lib.rs#L301

To explain, detailed diagnostics has a memory overhead. To emit it you need to provide the context that was used to compile the program, all loaded sources, and the compiled unit (with debug info).

from rune.

VorpalBlade avatar VorpalBlade commented on August 23, 2024 1

Actually, looking at it again, I'm not sure how I missed the emit method on the VmError type. Don't think there is much to improve (apart from my own reading comprehension).

from rune.

VorpalBlade avatar VorpalBlade commented on August 23, 2024

first_location is also useless, another private type, and it appears to print a bunch of byte code with Debug, and doesn't implement Display.

from rune.

VorpalBlade avatar VorpalBlade commented on August 23, 2024

Thank you, I propose adding some cross references to the docs for VmError about this. In fact I'll make a PR later today for it.

Discoverability when trying to solve an issue is a probkem in the rustdoc of many large Rust projects (not only Rune, I have struggled with clap and bpaf before for example). Part of that is due to the sub-par search function of rustdoc (only matching names of types/functions).

from rune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.