Retry XIVAPI requests once if they fail
This commit is contained in:
parent
e54bffe7fb
commit
1e6aeda945
2 changed files with 13 additions and 5 deletions
|
|
@ -290,7 +290,13 @@ class CardCreator {
|
|||
* @returns {Promise<Buffer>} A promise representating the construction of the card's image data.
|
||||
*/
|
||||
async createCard(charaId, customImage) {
|
||||
const response = await fetch(`https://xivapi.com/character/${charaId}?extended=1&data=FC,mimo`);
|
||||
const characterInfoUrl = `https://xivapi.com/character/${charaId}?extended=1&data=FC,mimo`;
|
||||
const response = await fetch(characterInfoUrl);
|
||||
if (!response.ok) {
|
||||
// Retry once if the request fails
|
||||
response = await fetch(characterInfoUrl);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
const canvasSize = this.canvasSize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue