Chào anh Dũng và mọi người
Em đang thực hiện task: tích hợp
Twilio vào dự án backend của công ty.
Em định nghĩa 1 class tên MessageClient trong
Service layer như sau:
import TwilioClient
class MessageClient:
def __init__(self):
self.twilio_client = TwilioClient(twilio_account_sid, twilio_auth_token)
def send_message(body, from, to):
self.twilio_client.send_message(body, from, to)
send_message có thể successful hoặc failed, nếu fail
twilio sẽ raise exception, em đang phân vân liệu mình sẽ handle exception trong service layer hay trong view (API) layer?
Mong anh giải đáp giúp !
Em cảm ơn ạ.