Comments (2)
We can also discuss various options of the API for the ResponseError
class. A few that come to mind:
- Option A (Same as above)
const error = new ResponseError(message: string, meta?: Object);
- Option B
const error = new ResponseError(message: string, code?: string, meta?: Object);
- Option C
const error = new ResponseError(message: string);
error.code = 'some-code';
error.meta = {some: meta};
- Option D
const error = new ResponseError({message: 'string', anyOtherThing: 'something'});
A few pros/cons.
Options A/B/D all have the con of having a different constructor API than the standard Error
class.
Option C has the same API as the standard Error
class but requires more boilerplate to accomplish the same thing.
Options A/B/C have the con of less flexibility in terms of what keys are used in the response.
Option D allows any shape of response, but deviates the most from the original Error api.
from fusion-plugin-rpc.
I decided to go with option C in the PR. Feel free to comment if you disagree
from fusion-plugin-rpc.
Related Issues (20)
- Fix flow types
- Update fusion-plugin-rpc handling of routePrefix to not prepend to fetch calls
- Test Issue
- Action Required: Fix Renovate Configuration
- Update error message to have more info
- Add mock export for use in testing
- Migrate fusion-plugin-rpc to DI
- Migrate fusion-plugin-rpc to createPlugin
- Add MIT license header to top of all source files
- Make createPlugin asynchronous HOT 1
- Add Flow types to source files
- Import Flow declaration for 'fetch'
- Ensure plugin provides `{from(ctx)}`
- Update `README.md` to `createPlugin` API
- Remove unnecessary handlers token from browser
- Migrate to new fusion-tokens api
- Add Token dependencies to readme
- Update dependencies
- Update dependencies
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 fusion-plugin-rpc.