Skip to content

Commit

Permalink
✔ Error Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bifeldy committed Aug 13, 2023
1 parent aa6c1a4 commit e4c2b67
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/api/controllers/anime-/anime-seasonal.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ export class AnimeSeasonalController {
status = res_rawn.status;
next = res_jsonn.paging?.next;
} else {
throw new Error('Gagal Tarik Data Anime');
throw new Error('Gagal Tarik Data Anime!');
}
}
}
else {
throw new Error('Gagal Tarik Data Anime');
throw new Error('Gagal Tarik Data Anime!');
}
const responseBody = {
info: `😅 ${status} - Anime API :: Seasonal ${season} ${year} 🤣`,
Expand Down
4 changes: 2 additions & 2 deletions src/api/controllers/anime.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AnimeController {
}
return responseBody;
}
throw new Error('Gagal Tarik Data Anime');
throw new Error('Gagal Tarik Data Anime!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down Expand Up @@ -180,7 +180,7 @@ export class AnimeController {
}
return responseBody;
}
throw new Error('Gagal Tarik Data Anime');
throw new Error('Gagal Tarik Data Anime!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/dorama-/dorama-seasonal.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class DoramaSeasonalController {
}
return responseBody;
}
throw new Error('Gagal Tarik Data Dorama');
throw new Error('Gagal Tarik Data Dorama!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down
4 changes: 2 additions & 2 deletions src/api/controllers/dorama.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class DoramaController {
}
return responseBody;
}
throw new Error('Gagal Tarik Data Dorama');
throw new Error('Gagal Tarik Data Dorama!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down Expand Up @@ -176,7 +176,7 @@ export class DoramaController {
}
return responseBody;
}
throw new Error('Gagal Tarik Data Dorama');
throw new Error('Gagal Tarik Data Dorama!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/fansub-/fansub-dns.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export class FansubDnsController {
}
return responseBody;
}
throw new Error('Gagal Tarik Data DNS Zone');
throw new Error('Gagal Tarik Data DNS Zone!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/information.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class InformationController {
} else if (informations.length === 1) {
infoCreateOrUpdate = informations[0];
} else {
throw new Error('Data Duplikat');
throw new Error('Data Duplikat!');
}
if ('title' in req.body) {
infoCreateOrUpdate.title = infoTemplate.title;
Expand Down
4 changes: 2 additions & 2 deletions src/api/controllers/likedislike.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class LikedislikeController {
}
result = auditedLikedislike;
} else {
throw new Error('Data Duplikat');
throw new Error('Data Duplikat!');
}
if (req.params['type'] === 'user') {
selectedRepo = this.profileRepo;
Expand Down Expand Up @@ -429,7 +429,7 @@ export class LikedislikeController {
}
};
} else {
throw new Error('Data Duplikat');
throw new Error('Data Duplikat!');
}
}
return {
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/mail-/mail-webhook.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class MailWebhookController {
result: mailboxSave
};
}
throw 'Data Tidak Lengkap!';
throw new Error('Data Tidak Lengkap!');
} catch (error) {
if (error instanceof HttpException) throw error;
throw new HttpException({
Expand Down
4 changes: 2 additions & 2 deletions src/api/controllers/verify-/verify-sosmed.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class VerifySosmedController {
relations: ['user_']
});
if (count > 0) {
throw 'Akun Telah Digunakan!';
throw new Error('Akun Telah Digunakan!');
}
const sosmeds = await this.sosmedRepo.find({
where: [
Expand Down Expand Up @@ -89,7 +89,7 @@ export class VerifySosmedController {
refresh_token: refreshToken
});
} else {
throw 'Akun Telah Digunakan!';
throw new Error('Akun Telah Digunakan!');
}
} catch (error) {
throw new HttpException({
Expand Down
2 changes: 1 addition & 1 deletion src/api/guards/filter-api-key-access.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class FilterApiKeyAccessGuard implements CanActivate {
relations: ['user_']
});
if (apiKeySystemCount <= 0) {
throw 'API-Key Tidak Memiliki Hak Akses!';
throw new Error('API-Key Tidak Memiliki Hak Akses!');
}
} catch (error) {
throw new HttpException({
Expand Down
2 changes: 1 addition & 1 deletion src/api/repository/api-key.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class ApiKeyService {
}
try {
if (!key) {
throw 'Tidak Ada API Key';
throw new Error('Tidak Ada API Key!');
}
const apiKey = await this.findOneOrFail({
where: [
Expand Down
2 changes: 1 addition & 1 deletion src/api/services/discord.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class DiscordService {
}
}
} else {
throw new Error('Github API Error');
throw new Error('Github API Error!');
}
} catch (error) {
this.gs.log('[DISCORD_SERVICE-CHANGE_BOT_NICKNAME] 🎉', error, 'error');
Expand Down
2 changes: 1 addition & 1 deletion src/api/services/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class MailService {
this.gs.log(`[MAILTRAP_SERVICE-SEND_EMAIL_SUCCESS] 💌`, resp.message_ids);
return resp;
}
throw new Error('MailTrap API Error');
throw new Error('MailTrap API Error!');
} catch (err) {
this.gs.log('[MAILTRAP_SERVICE-SEND_EMAIL_ERROR] 💌', err, 'error');
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/api/services/quiz.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export class QuizService {
return;
}
}
throw 'Kuis Tidak Tersedia';
throw new Error('Kuis Tidak Tersedia!');
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/services/socket-io.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class SocketIoService {
if (payload.key) {
const check = await this.aks.checkKey(payload.ip, payload.key);
if (!check.allowed) {
throw 'User Not Allowed';
throw new Error('User Not Allowed!');
} else if (check.user) {
user = check.user;
}
Expand All @@ -223,7 +223,7 @@ export class SocketIoService {
user = decoded.user;
}
if (!user) {
throw 'User Not Login';
throw new Error('User Not Login!');
}
payload.user = await this.userRepo.findOneOrFail({
where: [
Expand Down

0 comments on commit e4c2b67

Please sign in to comment.