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

Legacy API does not detect obvious errors #47

Open
jonathanfine opened this issue Oct 3, 2014 · 0 comments
Open

Legacy API does not detect obvious errors #47

jonathanfine opened this issue Oct 3, 2014 · 0 comments

Comments

@jonathanfine
Copy link
Contributor

In the legacy API each connection send() and sendreceive() starts with a drain(). This allows reporting of errors, as below.

>>> world.setBlock()
>>> world.conn.drain()
Drained Data: <Fail>
Last Message: <world.setBlock()>
>>> world.setBlock(50, 24, 3, 3, 3)
>>> world.conn.drain()
>>> world.setBlock(50, 24, 3, 23, 3)
>>> world.conn.drain()
Drained Data: <Fail>
Last Message: <world.setBlock(50,24,3,23,3)>

There are a number of things wrong with this. From my point of view the worst is that the legacy API relies on Minecraft to detect and report obvious errors in the input. I'd like to be able to develop and test code without having to run it against Minecraft to detect obvious problems.

Put another way, if an API call is made with obviously improper parameters I'd like Python to raise an exception and not pass the call on to Minecraft.

I am about to start writing a low-level API that provides this.

Here's something else that is wrong. No error from

>>> world.setBlock(50, 24, 3, 3.8)
>>> world.getBlock(50, 24, 3)
3
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

No branches or pull requests

1 participant