GithubHelp home page GithubHelp logo

Comments (2)

casperbakker avatar casperbakker commented on August 19, 2024

Thanks for the kind words.

I don't have plans for graceful failures if validation fails. This code should do basic validation of the inputs and trough an exception if it is invalid.

What are you planning? An error message on the generated barcode? Or also exceptions but more explicit?

from php-barcode-generator.

objecttothis avatar objecttothis commented on August 19, 2024

A common experience is for us, but I'm sure other users of the open source project I'm working on is where the Barcode type is selected in the settings, but an item does not have a valid barcode of that type. It sounds like me wrapping the call in a try catch block then acting appropriately based on exceptions thrown is the way to go, but here are some things I'm looking at trying to figure out:

  • Barcode type guessing. For example, in our use, we generally want EAN13 barcodes, but occasionally an ISBN-10 is in the field and some of those end in 'x', which fails on an EAN13.
  • On failure, use a backup barcode type. For now, when an exception is thrown, I can use that to use a solid backup (like CODE128)

In the end, I suppose it makes more sense for the exception to be thrown. Currently the thrown exception does state that x is not allowed or that the check digit failed. As I'm thinking through it, I think maybe my feature request would be for a type guessing function in the library or the ability to not pass the type and have it try to guess when the type is not passed. These are all things that I can implement in my code, but I thought I'd ask before doing it.

from php-barcode-generator.

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.