Skip to content

Commit

Permalink
handle blizzard 403s on character media endpoint
Browse files Browse the repository at this point in the history
this fixes character search. we won't get profile pictures, unfortunately
  • Loading branch information
emallson committed Apr 12, 2024
1 parent b53e8ca commit ddb2f22
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/route/blizzard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as cache from "../../cache";
import * as api from "./api";
import { cacheControl } from "../../common/cache-control";
import { AxiosError } from "axios";
import * as Sentry from "@sentry/node";

type CharacterParams = {
id: string;
Expand Down Expand Up @@ -59,10 +60,19 @@ async function fetchCharacter(
}

const [media, specs] = await Promise.all([
api.fetchCharacterMedia(region, realm, name, isClassic),
api.fetchCharacterMedia(region, realm, name, isClassic).catch((error) => {
// not reporting this to sentry because the blizzard api is currently sending 403s from this endpoint to ALL requests
console.error("failed to retrieve character media", error);
return undefined;
}),
isClassic
? Promise.resolve(undefined)
: api.fetchCharacterSpecializations(region, realm, name, isClassic),
: api
.fetchCharacterSpecializations(region, realm, name, isClassic)
.catch((error) => {
Sentry.captureException(error);
return undefined;
}),
]);

const thumbnailAsset =
Expand Down

0 comments on commit ddb2f22

Please sign in to comment.