Git Product home page Git Product logo

Comments (1)

mikejritter avatar mikejritter commented on August 30, 2024

Note that I'm trying to inform these from the ideas on the Condition Failures Explained page from guava.

For BagProfile I think it makes sense to use a checked exception - we already have ProfileValidationException so that's a good place to start, though it is a checked exception. I would probably prefer to use a Result and have that provide information on errors over throwing an exception, but trying to keep this to as few changes as possible at the moment.

There are also other classes throwing unchecked exceptions:

BagConfig

  • when creating, a RuntimeException is thrown if there is no Bag-Info section
    • Is this really an error? I can see why it might be enforced before, but this might be able to be removed
  • when creating, a RuntimeException is thrown if the path to the yaml does not exist
    • The constructor could be updated to take a stream -- still likely exceptions that can occur (or Reader looks like it would be the best fit)
  • when creating, a RuntimeException is thrown if the yaml cannot be parsed
    • IllegalStateException?

SerializationSupport

  • when getting a BagDeserializer, a RuntimeException is thrown if tika cannot detect the content type
    • Maybe allow the IOException to continue up the chain
  • when getting a BagDeserializer, a RuntimeException is thrown if the BagProfile does not support the content type
    • Initially was thinking about using an IllegalArgumentException, but it's the file being read so maybe there's a better option
  • when getting a BagSerializer, a RuntimeException is thrown if the BagProfile does not support the content type
    • same as above

BagWriter

  • when registering a checksum, a RuntimeException is thrown if the MessageDigest algorithm was not registered when creating the BagWriter
    • Maybe IllegalArgumentException would be better, since the argument for the algorithm is invalid

from bagit-support.

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.