Giter Site home page Giter Site logo

custom P3 error classes about p3 HOT 6 CLOSED

pavel-krivanek avatar pavel-krivanek commented on June 15, 2024
custom P3 error classes

from p3.

Comments (6)

svenvc avatar svenvc commented on June 15, 2024

You are right, but PostgreSQL is an extremely large and complex program. P3's mission is to be lean and mean.

Mapping all errors to different classes would be a lot of work.

It was a design decision to use just one error and one notification class (but it contains the actual DB error info).

So far this worked fine for me. How/where do you need more ?

from p3.

pavel-krivanek avatar pavel-krivanek commented on June 15, 2024

I think that it should be ok to have one just one error class but to use some aspect describing the problem or fill always some specific key in notice info.

For example, current code uses self error: 'Password required' which does not give us any reasonable option to inform user in selected application language about the cause of problem.

In our application we use calls like pdmError: aSymbol text: aString attribute: anAttribute (and shorter variants while the symbol needs to be always set). It signals a custom error instance and we can use the symbol as key for error translation using Gettext + provide next information from the rest of the arguments.

from p3.

svenvc avatar svenvc commented on June 15, 2024

See bf41906 for a new approach

This is based on how PostgreSQL errors are structured. Using #isLocal and #code you should have keys to work with, I hope.

from p3.

pavel-krivanek avatar pavel-krivanek commented on June 15, 2024

Thanks! in the commit, there seems to be a forgotten halt

from p3.

svenvc avatar svenvc commented on June 15, 2024

Ah yes, that method should not be called anyway, but I will remove it

from p3.

svenvc avatar svenvc commented on June 15, 2024

Done

from p3.

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.