title: Django REST (DRF) - error handling in api_view
body: <p>I have the following API view and serializer to change a users password:</p>
  <p>views.py</p>
  <pre><code>@api_view(['POST'])
  @permission_classes([AllowAny])
  def user_create(request):
      exception_handler = UserUnavailable
      success_handler = UserCreated
      if request.method == 'POST':
          creation_serializer = UserCreateSerializer(data=request.data)
          try:
              if creation_serializer.is_valid(raise_exception=True):
                  creation_serializer.save()
                  user_serializer = NewUserSerializer(instance=creation_serializer.instance)
                  return JsonResponse(
                      {&quot;status_code&quot;: success_handler.status_code,
                       &quot;default_detail&quot;: success_handler.default_detail,
                       &quot;default_code&quot;: success_handler.default_code,
                       &quot;new_user&quot;: user_serializer.data,
                       }, status=status.HTTP_201_CREATED, safe=False)
  
          except APIException:
              return Response(
                  {&quot;status_code&quot;: exception_handler.status_code,
                   &quot;default_detail&quot;: exception_handler.default_detail,
                   &quot;default_code&quot;: exception_handler.default_code},
                  status=status.HTTP_400_BAD_REQUEST
              )
  </code></pre>
  <p>serializers.py</p>
  <pre><code>class UserPasswordSerializer(serializers.ModelSerializer):
      user = serializers.PrimaryKeyRelatedField(read_only=True, default=serializers.CurrentUserDefault())
      password = serializers.CharField(max_length=128, write_only=True, required=True, validators=[validate_password])
      password2 = serializers.CharField(max_length=128, required=True)
      old_password = serializers.CharField(max_length=128, required=True)
  
      class Meta:
          model = get_user_model()
          fields = ('user', 'password', 'password2', 'old_password')
          extra_kwargs = {'password': {'write_only': True}}
  
      def validate_old_password(self, value):
          user = self.context['request'].user
          if not user.check_password(value):
              raise serializers.ValidationError(
                  ({'old_password': _(&quot;Your old password was entered incorrectly. Please enter it again..&quot;)})
              )
          return value
  
      def validate(self, data):
          if data['password'] != data['password2']:
              raise serializers.ValidationError({'password2': _(&quot;The two password fields didn't match.&quot;)})
          password_validation.validate_password(data['password'])
          return data
  
      def save(self, **kwargs):
          password = self.validated_data['password']
          user = self.context['request'].user
          user.set_password(password)
          user.save()
          return user
  </code></pre>
  <p>If I update a users password I simply get back http200 and the password has been set, nice! But if I send the same request a second time I just get back:</p>
  <pre><code>{
    &quot;status&quot;: &quot;error&quot;,
    &quot;error&quot;: &quot;Bad Request&quot;
  }
  </code></pre>
  <p>Actually I would expect to end-up in the except APIException block and get the corresponding http content returned, but instead I only get the default http400 of DRF, why that? Beside i would also expect to somehow get the serializers.ValidationError returned if any occurs.</p>
  <p>P.S. I'm new to DRF.</p>
  <p>Thanks in advance</p>