Code Monkey home page Code Monkey logo

Comments (1)

Southclaws avatar Southclaws commented on June 19, 2024

Funnily enough one of the main motivations for building Fault was sql.ErrNoRows breaking some rules around error handling.

short history note...

Basically, by using that type in error checks, we're leaking the underlying database details to the service layer with "SQL" and tying the concept of "not found" to only SQL related queries. If something was "not found" when querying MongoDB, Elasticsearch or S3 that means (by following this pattern) we need 4 custom error types and 4 checks in every handler to translate these errors into HTTP status codes. And thus, Fault's ftag (originally called errtag) was born.

end of history note

With regards to withSql I like the idea and I think it's very useful. This use-case is exactly why Fault is designed with the simple func(error) error pattern. And I'm happy to see the idea providing value!

However, I'm hesitant to add this to the library as it's quite use-case specific (raw sql usage without a library, some teams use ORMs, or Ent, or a different relational/non-relational database system.) And I'd imagine many teams wouldn't want all parameters of queries, which may contain sensitive information, be stored and potentially accessed for logging etc.

However, I think it would be good to add a section to the readme that links libraries that work well with Fault's wrapper interface.

from fault.

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.