Throw exception on email or sms api limits.
This commit is contained in:
		
							parent
							
								
									7298b001d2
								
							
						
					
					
						commit
						9263e53c1d
					
				@ -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!");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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!");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user