Skip to content

Commit

Permalink
refactor(plugins#MiscLoader): improve texts and error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
xayanide committed May 27, 2022
1 parent 6cee558 commit 178752f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/plugins/MiscLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ export class MiscLoader extends LobbyPlugin {
if (e instanceof FetchProfileError) {
switch (e.reason) {
case FetchProfileErrorReason.FormatError:
this.logger.error(`Couldn't parse the webpage. checked:${player.id}`);
this.logger.error(`Failed to parse the webpage. Checked player:${player.id}`);
break;
case FetchProfileErrorReason.NotFound:
this.logger.info(`Profile not found. checked:${player.id}`);
this.logger.info(`Profile cannot be found. Checked player:${player.id}`);
break;
}
} else {
this.logger.error(`unexpected error. checking:${player.id}, err:\n${e.message}\n${e.stack}`);
this.logger.error(`@MiscLoader#getProfile: There was an error while checking player ${player.id}\n${e.message}\n${e.stack}`);
}
}
}
Expand All @@ -97,34 +97,34 @@ export class MiscLoader extends LobbyPlugin {
const map = await BeatmapRepository.getBeatmap(mapId, this.lobby.gameMode);
this.canResend = false;
if (!map) {
this.lobby.SendMessage('Current beatmap doesn\'t have mirror...');
this.lobby.SendMessage('The current beatmap doesn\'t have a mirror.');
this.canResend = false;
return;
}
this.canResend = true;
const beatconnectLink = this.beatconnectURL.replace(/\$\{beatmapset_id\}/g, map.beatmapset_id.toString());
const kitsuLink = this.kitsuURL.replace(/\$\{beatmapset_id\}/g, map.beatmapset_id.toString());
const beatmapView = map.beatmapset?.title.toString();
this.lobby.SendMessageWithCoolTime(`Alternative download link for ${beatmapView} : [${beatconnectLink} BeatConnect.io] | [${kitsuLink} Kitsu.moe]`, '!mirror', 5000);
this.lobby.SendMessageWithCoolTime(`Alternative download link for beatmap ${beatmapView}: [${beatconnectLink} BeatConnect.io] | [${kitsuLink} Kitsu.moe]`, '!mirror', 5000);
} catch (e: any) {
this.canResend = false;
if (e instanceof FetchBeatmapError) {
switch (e.reason) {
case FetchBeatmapErrorReason.FormatError:
this.logger.error(`Couldn't parse the webpage. checked:${mapId}`);
this.logger.error(`Failed to parse the webpage. Checked beatmap: ${mapId}`);
break;
case FetchBeatmapErrorReason.NotFound:
this.logger.info(`Map can not be found. checked:${mapId}`);
this.logger.info(`Beatmap cannot be found. Checked beatmap: ${mapId}`);
break;
case FetchBeatmapErrorReason.PlayModeMismatched:
this.logger.info(`Gamemode Mismatched. checked:${mapId}`);
this.logger.info(`Gamemode mismatched. Checked beatmap: ${mapId}`);
break;
case FetchBeatmapErrorReason.NotAvailable:
this.logger.info(`Map is not available. checked:${mapId}`);
this.logger.info(`Beatmap is not available. Checked beatmap: ${mapId}`);
break;
}
} else {
this.logger.error(`unexpected error. checking:${mapId}, err:\n${e.message}\n${e.stack}`);
this.logger.error(`@MiscLoader#checkMirror: There was an error while checking beatmap ${mapId}\n${e.message}\n${e.stack}`);
}
}
}
Expand Down

0 comments on commit 178752f

Please sign in to comment.