Giter Site home page Giter Site logo

Comments (7)

dsrw avatar dsrw commented on July 18, 2024 1

raises isn't for handling exceptions. It's a way of validating which exceptions a procedure can raise, so you can be confident that your code can't raise anything you're not prepared to handle. You may choose to use it to guard against certain kinds of bugs, but it really doesn't have anything to do with interfacing with godot-nim.

The exception you're seeing occurs before your code is called, so there really isn't anything you can do to handle it. Strings and seqs in nim worked differently when godot-nim was written (before nim 1.0), and occasionally bugs pop up as a result, particularly when dealing with 0 length strings/seqs. I opened PR #114 with a fix.

In the meantime you can try using requires "https://github.com/dsrw/godot-nim#f2af444" instead of requires "godot-nim 0.8.5".

from godot-nim.

insomniacUNDERSCORElemon avatar insomniacUNDERSCORElemon commented on July 18, 2024 1

Closing as most of my issues relevant to this (other than beginner notes) are addressed. dsrw's fix worked.

from godot-nim.

endragor avatar endragor commented on July 18, 2024

You should deal with exceptions on Nim level. If it gets propagated past your exported procedure, then you get an error message in the log. Godot doesn't support a notion of exceptions.

from godot-nim.

insomniacUNDERSCORElemon avatar insomniacUNDERSCORElemon commented on July 18, 2024

The problem is that it's Nim taking issue with the signal sent from Godot.

Unhandled Nim exception (IndexDefect): index out of bounds, the container is empty

Is the way I've tried to fix it not the proper way? In my function I want to check for empty data and handle that differently, but the raises effect/pragma isn't working for it.

EDIT: To be clear, that error is sent even when the procedure only has a print statement of a basic string, so it isn't caused by the Nim code itself. Just the signal.

Also I don't see a way to disable the argument for changed text (it seems to be just default, advanced just has the option to add) at least via the UI for Godot's signal connection. It's not a big deal to re-work it, but I wanted to check the entered text and enable/disable buttons (this is for a dec/bin/hex number converter).

from godot-nim.

insomniacUNDERSCORElemon avatar insomniacUNDERSCORElemon commented on July 18, 2024

raises isn't for handling exceptions. It's a way of validating which exceptions a procedure can raise, so you can be confident that your code can't raise anything you're not prepared to handle

I thought it ignored (specified) raised exceptions, is there no way to do that to deal with issues like this in the future? This seems like a clear case of knowing the issue is there meaning that it can be dealt with (ignoring invalid input).

from godot-nim.

dsrw avatar dsrw commented on July 18, 2024

Normally you'd put the call in a try/except block and handle (or not handle) the error however you want, but, unless I'm misunderstanding the issue, your code isn't really involved. The error is coming from inside godot-nim. If you look at the stack trace I don't think you'll see any of your files.

You're not doing anything wrong. It's a subtle incompatibility between godot-nim and more recent nim versions. It's something that should be fixed in godot-nim.

from godot-nim.

insomniacUNDERSCORElemon avatar insomniacUNDERSCORElemon commented on July 18, 2024

unless I'm misunderstanding the issue, your code isn't really involved. The error is coming from inside godot-nim.

Correct. I already understood that, was just wondering if there was a way that Nim allowed to get around it.

Side-note to stop me from making a separate issue, can you tell me how to change Godot settings via Nim, such as OS.min_window_size? The API has it as _OS but that gives an error w/Nim so I'm not sure if that is a bug or not. EDIT: nevermind, ctrl+f on the documentation and it's gd_os. Import and gd_os.set_min_window_size(vec2(200, 150))

Also even smaller is adding to stuff like position/rotation directly (especially for stuff like position.x). I've figured out how to use editSetPostion but it's a bit clunky to use that alongsite editGetPosition.

(feel free to not respond if you don't know off the top of your head, also see that I opened an issue about search being broken)

from godot-nim.

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.