Comments (4)
I understand the motivation for never throwing exceptions, but I think we're failing to meet the spirit of this for client-side JS if we allow exceptions when creating a client, because of the unique lifecycle of browser-based apps. For a client-side app the client is often created just before an evaluation is done, so an exception thrown during client creation is pretty much just as disruptive as an exception when you call a method.
@moredip This makes sense. I agree.
Even in some toy examples, I've created clients per-request on the server, and I think that's a pattern we want to support.
I imagine the normal setup will involve creating a client/provider which includes passing some kind of ID to the provider (application/team/environnment ID/key etc). I would imagine that the provider will do some initialization etc.
What do you propose to do if the coder provides an invalid key/id etc in this case? To me, throwing an error is the most obvious thing.
The provider registration happens on the global API singleton, not on the client. The client is a lightweight class for doing evaluation with the previously registered, global provider, thats generated from the global API singleton. I think that provider registration is where the sort of exception you're mentioning would occur.
// this can probably throw
var myProvider = new MyProvider(SUPER_SECRET_APP KEY)
// this can probably throw too
openfeature.registerProvider(myProvider);
// this should probably not
var client = openfeature.getClient(...)
from spec.
I imagine the normal setup will involve creating a client/provider which includes passing some kind of ID to the provider (application/team/environnment ID/key etc). I would imagine that the provider will do some initialization etc.
What do you propose to do if the coder provides an invalid key/id etc in this case? To me, throwing an error is the most obvious thing.
from spec.
This also might relate to a question that's come up a few times: do we want to expose events (specifically readiness events) from the provider interface? Providers could sidestep this by requiring SDKs that have a readiness event simply be ready BEFORE passing them into the provider. For instance, the CloudbeesProvider may require an already-initialized Cloudbees SDK instance. Not sure.
from spec.
I guess the only question here is if we should specifically add a requirement that .getClient()
calls never throw. I think it's probably a good thing to do.
from spec.
Related Issues (20)
- Spec styling and consistency issues HOT 2
- [Question] `API.shutdown()` required in Go? HOT 5
- [Question] Static vs Dynamic context terminology HOT 1
- [bug] Multiple providers bound to one "name", and associated issues HOT 11
- Spec could be more clear about named-client/provider binding. Would "namespace" help? HOT 6
- Provider Initialization Fallback HOT 4
- Consider 0.7.0 release HOT 1
- Specify provider state after `shutdown()` HOT 8
- [Static-context Paradigm] How to handle errors in `on context changed` HOT 2
- Any plans to create feature flag code management project? HOT 5
- Manage context per named provider when using the static-context paradigm HOT 1
- Set context during provider registration when using the static-context paradigm HOT 3
- Redefine named clients as domain
- Clarification of reason for evaluation detail and evaluation. HOT 2
- DOC:Best practices or Cases HOT 10
- Proposal to move `Provider Status` field from provider to SDK, refine semantics around ContextChange events HOT 22
- Multi Provider for OpenFeature HOT 6
- tooling: Publish repo spec compliance docker container to github packages HOT 1
- Document compliance differences between different sdks HOT 4
- Consider the ability to opt-out from automatic functionality such as automatic provider ready events. HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spec.