Skip to content

Commit

Permalink
Add error message for rows_with_combined_variable_content_too_long
Browse files Browse the repository at this point in the history
  • Loading branch information
whabanks committed Apr 23, 2024
1 parent 522451e commit 966e3d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/v2/notifications/post_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import werkzeug
from flask import abort, current_app, jsonify, request
from notifications_utils import SMS_CHAR_COUNT_LIMIT
from notifications_utils.recipients import (
RecipientCSV,
try_validate_and_format_phone_number,
Expand Down Expand Up @@ -699,6 +700,12 @@ def check_for_csv_errors(recipient_csv, max_rows, remaining_messages):
message=f"You cannot send to these recipients {explanation}",
status_code=400,
)
if any(recipient_csv.rows_with_combined_variable_content_too_long):
raise BadRequestError(
message=f"Row {next(recipient_csv.rows_with_combined_variable_content_too_long).index} - Contains custom content that exceeds the {SMS_CHAR_COUNT_LIMIT} character limit when combined with your template's content.",
status_code=400,
)

if recipient_csv.rows_with_errors:

def row_error(row):
Expand Down

0 comments on commit 966e3d0

Please sign in to comment.