-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Status
is just a wrapper for Promise
Current Status:
class Status {
async ok():Promise<boolean> {
constructor(promise:Promise) {
this.promise = promise
}
try {
await this.promise
return true
catch(e){
return false
}
}
}
const status = new Status(promise)
if (await status.ok()) {
// do stuff
}
refactor:
async function method(){
let error:void|Error
try {
await promise
} catch(e){
error = e
}
return e
}
if (!(await method())) {
// do stuff
}
Metadata
Metadata
Assignees
Labels
No labels