-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
there is inside of the api many times the same-ish code :
let data = this.someCall()
if(data.status){
// work
} else {
// return the error
}or
if(this.connectLevel >n){
//work
}else {
// return generic error
}those kind of code are everywhere sometimes in both the api and the application using the api thus finding a way to avoid this duplicated code will improve code clarity as well as quality
proposals :
- the return object could be enhanced with generic methods like
thenandelseto setup handlers this might have some side effect as sometimes the existence of athenmethod is used to know if the object can used like a promise - a method factory can be used to wrap methods and handle basic tests like the connect level although this will probably be complicated hard to maintain and be a bug factory instead of a method factory. This way may also cause trouble for documentation and completion helper inside some IDEs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request