Renaming function to make it clear that logging happens

This commit is contained in:
podar 2024-09-16 13:30:04 -05:00
parent 96aada282f
commit 6db0cc8d08

View File

@ -494,7 +494,7 @@ export function initMoveAnim(scene: BattleScene, move: Moves): Promise<void> {
.then(response => { .then(response => {
const contentType = response.headers.get("content-type"); const contentType = response.headers.get("content-type");
if (!response.ok || contentType?.indexOf("application/json") === -1) { if (!response.ok || contentType?.indexOf("application/json") === -1) {
useDefaultAnim(move, defaultMoveAnim, response.status, response.statusText); useAndLogDefaultAnim(move, defaultMoveAnim, response.status, response.statusText);
return resolve(); return resolve();
} }
return response.json(); return response.json();
@ -516,7 +516,7 @@ export function initMoveAnim(scene: BattleScene, move: Moves): Promise<void> {
} }
}) })
.catch(error => { .catch(error => {
useDefaultAnim(move, defaultMoveAnim, error); useAndLogDefaultAnim(move, defaultMoveAnim, error);
return resolve(); return resolve();
}); });
}; };
@ -532,7 +532,7 @@ export function initMoveAnim(scene: BattleScene, move: Moves): Promise<void> {
* @param defaultMoveAnim the default move to use as the default animation * @param defaultMoveAnim the default move to use as the default animation
* @param optionalParams parameters to add to the error logging * @param optionalParams parameters to add to the error logging
*/ */
function useDefaultAnim(move: Moves, defaultMoveAnim: Moves, ...optionalParams: any[]) { function useAndLogDefaultAnim(move: Moves, defaultMoveAnim: Moves, ...optionalParams: any[]) {
const moveName = Utils.animationFileName(move); const moveName = Utils.animationFileName(move);
console.error(`Could not load animation file for move '${moveName}'`, ...optionalParams); console.error(`Could not load animation file for move '${moveName}'`, ...optionalParams);
populateMoveAnim(move, moveAnims.get(defaultMoveAnim)); populateMoveAnim(move, moveAnims.get(defaultMoveAnim));