Coder Social home page Coder Social logo

Comments (3)

twoolie avatar twoolie commented on June 15, 2024

How do you mean uncaught exception on empty file? do you mean that the exception generated when opening an empty file is not caught and re-raised as something more descriptive, or do you think that in the case of an empty file, a valid nbt structure should be inserted automatically.
I have no problem with the first option, in fact i would be happy to add that straight away, however as for the latter solution i would be worried that this behavior would potentially mask any underlying problem with non-valid files being loaded (I class empty files as invalid as per spec.)

from nbt.

MostAwesomeDude avatar MostAwesomeDude commented on June 15, 2024

After re-reading the spec, I do agree with you on this. Maybe an NBTException or something like that would be appropriate. The struct.errors are not obvious at all; it took me the better part of a day to figure out what happened when I first saw it!

from nbt.

twoolie avatar twoolie commented on June 15, 2024

Fixed this issue in latest commit. NBTFile now raises MalformedFileError on parse failure. if invoking parsing directly, struct.error is still returned by all tags as wrapping every failure point would add a lot of overhead.

(also fixed an edge case where TAG_String would not raise error on partial read)

from nbt.

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.