Skip to content

Commit d09cc59

Browse files
RED-93852: Adjust getSubscription() handle of 404 (#38)
1 parent 98a52de commit d09cc59

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/subscription.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import { TaskResponse } from '../types/task';
1414
import { Task } from '../api/task';
1515
import { Client } from './api.base';
16+
import { AxiosError } from 'axios';
1617

1718
export class Subscription {
1819
private task: Task
@@ -58,7 +59,10 @@ export class Subscription {
5859
const response = await this.client.get(`/subscriptions/${subscriptionId}`);
5960
return response.data;
6061
}
61-
catch(error) {
62+
catch(error: any | AxiosError) {
63+
if (error.name === 'AxiosError' && error.response.status === 404) {
64+
return error.response as SubscriptionResponse;
65+
}
6266
return error as any;
6367
}
6468
}

0 commit comments

Comments
 (0)