Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nim 2.0 fixes #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Nim 2.0 fixes #23

wants to merge 4 commits into from

Conversation

tuffnatty
Copy link

These changes make the code compile and work with Nim 2.0rc1.

finally:
if ok:
db.exec("COMMIT")
db.exec(if ok: "COMMIT" else: "ROLLBACK")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is why the tests are failing. The body is allowed to contain a return, break, or similar so ok = true might not execute. That the old code is no longer valid seems like an oversight in Nims exception tracking since a bare raise statement cannot raise anything that couldn't already be raised by the code in the try block :/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! I reverted this change, but had to add more stuff so that compiler would not mark every execMany/execScript call as possibly raising an Exception. Now the tests are passing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then I thought if we could understand in the finally block whether an exception is being raised, then we would not have to mess with except/raise; and so it seems, getCurrentException() can be used. So the last version is much simpler.

@tuffnatty
Copy link
Author

Ok, here is finally what I had in mind ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants