Skip to content

Commit 63b6f03

Browse files
Merge pull request #472 from codex-team/fix/cancel-subscription
fix(payments): Add try/catch to canceling error
2 parents 70780ed + 9a13670 commit 63b6f03

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.1.13",
3+
"version": "1.1.14",
44
"main": "index.ts",
55
"license": "UNLICENSED",
66
"scripts": {

src/billing/cloudpayments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export default class CloudPaymentsWebhooks {
196196
const context = req.context;
197197
const body: CheckRequest = req.body;
198198
let data;
199-
199+
200200
console.log('💎 CloudPayments /check request', body);
201201

202202
try {

src/resolvers/workspace.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,13 @@ module.exports = {
548548
throw new UserInputError('There is no subscription for provided workspace');
549549
}
550550

551-
await cloudPaymentsApi.cancelSubscription(workspaceModel.subscriptionId);
551+
try {
552+
await cloudPaymentsApi.cancelSubscription(workspaceModel.subscriptionId);
553+
} catch (err) {
554+
console.log('\nლ(´ڡ`ლ) Error [resolvers:workspace:cancelSubscription]: \n\n', err, '\n\n');
555+
556+
throw new ApolloError('Unable to cancel subscription');
557+
}
552558

553559
await workspaceModel.setSubscriptionId(null);
554560

0 commit comments

Comments
 (0)