Code Monkey home page Code Monkey logo

Comments (7)

juliangruber avatar juliangruber commented on March 29, 2024

It should throw or console.error in development and be silent in production.

What is a case where an extension overwrites another one and it's not a bad thing?

from koa.

jonathanong avatar jonathanong commented on March 29, 2024

well i don't see the point of being that strict. people may, for whatever reason, decide to overwrite a default property, but i don't see the point of stopping them from doing that. we can also do three options: throw, warn, and silent

from koa.

juliangruber avatar juliangruber commented on March 29, 2024

Options should be avoided where possible.

"may" and "for whatever reasons" aren't real arguments, people may also want to use koa in ruby ;)

from koa.

jonathanong avatar jonathanong commented on March 29, 2024

i wouldn't consider this an option, more like crippling the framework. you're purposely crippling extendability due to your own opinions. if tj wants koa to be an unopinionated framework, then it's better to let developers do whatever they want and just warn them that they may break things. maybe tj should define koa's philosophy on the readme :)

from koa.

jonathanong avatar jonathanong commented on March 29, 2024

oh, duh. you'd want to overwrite the default error handler at this.error, at least in koa's current form.

from koa.

tj avatar tj commented on March 29, 2024

this.error is just a temporary thing, I'll have something well-defined there api-wise soonish. I like the idea, I think maybe doing it with debug() though, and making sure DEBUG usage is really clear in the guide

from koa.

jonathanong avatar jonathanong commented on March 29, 2024

debug shows properties being defined, but did you want to warn when properties are being overwritten as well?

from koa.

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.