Skip to content

Commit be77adc

Browse files
authored
Merge pull request #370 from Quickchive/fix/catch-axios-4xx-error
fix: catch axios 4xx errors
2 parents 991792b + 9721de2 commit be77adc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/contents/util/content.util.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,16 @@ class OGCrawler {
7272

7373
return this.parse(response.data);
7474
} catch (error) {
75-
if (error instanceof AxiosError && error.response?.status === 403) {
76-
throw new ForbiddenException('og 데이터를 가져올 수 없는 링크입니다.');
75+
if (error instanceof AxiosError) {
76+
if (
77+
error?.response?.status === 400 ||
78+
error.response?.status === 403 ||
79+
error.response?.status === 404
80+
) {
81+
throw new ForbiddenException(
82+
'og 데이터를 가져올 수 없는 링크입니다.',
83+
);
84+
}
7785
}
7886

7987
throw new InternalServerErrorException('An unknown error occurred');

0 commit comments

Comments
 (0)