Comments (7)
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.
Closing as most of my issues relevant to this (other than beginner notes) are addressed. dsrw's fix worked.
from godot-nim.
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.
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.
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.
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.
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 EDIT: nevermind, ctrl+f on the documentation and it's 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.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)
- Nim constructor not found for class BulletPhysicsDirectSpaceState HOT 1
- Issue with connecting signal BodyEntered (area) HOT 1
- Generate .dll for other platforms (like Linux) HOT 4
- New native extension system for 4.0 HOT 1
- Basis getEuler behavior
- Add proc directionTo for vector2 and vector3
- GDExtentions Support HOT 1
- Nake Build Error HOT 14
- Nake build failed if GODOT_BIN path contains space character
- Documentation search doesn't do anything
- Export questions HOT 2
- Is this abandoned? What's happening HOT 4
- nake build error:: type expected but got symbol 'Array' of kind 'enumField' HOT 2
- godot-nim crashing godot (windows 10) [Solved?]
- I can't find the answers
- Error: type expected, but got symbol 'Array' of kind 'enumField' HOT 1
- is this abandoned? HOT 7
- Output is flooding with `A foreign thread is created` when i use NavigationAgent
- Cant compile to wasm
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot-nim.