Throw exception on email or sms api limits.

This commit is contained in:
Igor Kulikov 2020-11-25 12:55:23 +02:00
parent 7298b001d2
commit 9263e53c1d
2 changed files with 4 additions and 0 deletions

View File

@ -250,6 +250,8 @@ public class DefaultMailService implements MailService {
helper.setText(body);
mailSender.send(helper.getMimeMessage());
apiUsageClient.report(tenantId, ApiUsageRecordKey.EMAIL_EXEC_COUNT, 1);
} else {
throw new RuntimeException("Email sending is disabled due to API limits!");
}
}

View File

@ -106,6 +106,8 @@ public class DefaultSmsService implements SmsService {
apiUsageClient.report(tenantId, ApiUsageRecordKey.SMS_EXEC_COUNT, smsCount);
}
}
} else {
throw new RuntimeException("SMS sending is disabled due to API limits!");
}
}