Fakultas Ilmu Komputer UI

Verified Commit 7aee176a authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

[CHORES] Raise APIException on send_email error

parent c30bcf98
Pipeline #45082 passed with stages
in 2 minutes and 24 seconds
import json
import logging
from django.conf import settings
from django.core import mail
from django.http import HttpResponseRedirect
from django.shortcuts import reverse
from django.template.loader import render_to_string
from rest_framework import generics
from rest_framework import status, views
from django.utils.translation import gettext_lazy as _
from rest_framework import exceptions, generics, status, views
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework_authlib.tokens import AccessToken
......@@ -17,6 +18,8 @@ from . import (
tokens,
)
logger = logging.getLogger(__name__)
# Create your views here.
class HelloView(views.APIView):
......@@ -131,7 +134,9 @@ class RegisterFullView(generics.CreateAPIView):
html_message=html,
)
except Exception as err:
print(err)
logger.error(err)
raise exceptions.APIException(_("Fail sending email to your email address"),
code='email_failed')
class OAuthAccessTokenView(views.APIView):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment