Skip to content

Commit

Permalink
fix(promise): Add missing catch (#1407)
Browse files Browse the repository at this point in the history
* Add missing catch

* chore: apply lint
  • Loading branch information
robinsoncol authored and MateusAndrade committed Jul 4, 2023
1 parent 7878137 commit b9cf25d
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,24 @@ const RNShare = {
options.filenames = [options.filename];
}
}
NativeRNShare.open(options).then((ret: { success: boolean; message: string }) => {
if (ret.success) {
return resolve({
success: ret.success,
message: ret.message,
});
} else if (options.failOnCancel === false) {
return resolve({
dismissedAction: true,
success: ret.success,
message: ret.message,
});
} else {
reject(new Error('User did not share'));
}
});
NativeRNShare.open(options)
.then((ret: { success: boolean; message: string }) => {
if (ret.success) {
return resolve({
success: ret.success,
message: ret.message,
});
} else if (options.failOnCancel === false) {
return resolve({
dismissedAction: true,
success: ret.success,
message: ret.message,
});
} else {
reject(new Error('User did not share'));
}
})
.catch((e: unknown) => reject(e));
})
.catch((e: unknown) => reject(e));
});
Expand Down

0 comments on commit b9cf25d

Please sign in to comment.