PartnerCentralMarketing / Client / exceptions / ValidationException

ValidationException

class PartnerCentralMarketing.Client.exceptions.ValidationException

The input fails to satisfy the constraints specified by the service.

A caller branches on Reason, and where the rejection is attributable to particular fields it reads FieldList rather than parsing Message, which is prose and may change.

Example

try:
  ...
except client.exceptions.ValidationException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Reason': 'FIELD_VALIDATION_FAILED'|'CANNOT_PARSE'|'OTHER'|'CAMPAIGN_INCOMPLETE',
    'FieldList': [
        {
            'Name': 'string',
            'FieldId': 'string',
            'Message': 'string',
            'Code': 'VALUE_TOO_SHORT'|'VALUE_TOO_LONG'|'PATTERN_MISMATCH'|'DISALLOWED_HTML_TAG'|'WRONG_VALUE_TYPE'|'FILE_REFERENCE_INVALID'|'FILE_REFERENCE_NOT_OWNED'|'IMAGE_FORMAT_NOT_SUPPORTED'|'IMAGE_FORMAT_NOT_ALLOWED'|'IMAGE_TOO_LARGE'|'FILE_TOO_LARGE'|'SCAN_REJECTED'|'UNKNOWN_FIELD'|'IMAGE_ASPECT_RATIO_MISMATCH'|'FIELD_SET_ON_CAMPAIGN'|'EMAIL_COLUMN_MISSING'|'RECIPIENT_LIST_TOO_LARGE'|'RECIPIENT_LIST_EMPTY'|'INVALID_VALUE'|'NOT_SUPPORTED_FOR_CATEGORY'|'RECIPIENT_LIST_NOT_UTF8'|'FIELD_FROM_PARTNER_PROFILE'|'COPY_SOURCE_INVALID'|'SENDER_DOMAIN_NOT_ALLIANCE_LEAD'|'SENDER_DOMAIN_DKIM_MISSING'|'SENDER_DOMAIN_DMARC_MISSING'|'PARTNER_BADGE_NOT_ELIGIBLE'
        },
    ],
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) –

    The input fails to satisfy the constraints specified by the service.

    A caller branches on Reason, and where the rejection is attributable to particular fields it reads FieldList rather than parsing Message, which is prose and may change.

    • Message (string) –

      Error message.

    • Reason (string) –

      The single coarse reason the request was rejected, for a caller that does not care which field.

    • FieldList (list) –

      Every field that failed, not just the first.

      ⚠️ Every field, deliberately. The convention comment carried by most internal models — “if more than one field caused the error, pick one and elaborate in the message” — is the reading this service does NOT take: a partner editing a form would then discover their errors one request at a time. The whole request is validated and the full set reported, so one round of fixes is one call.

      Each entry names a member of the request just sent, and only that: the value to change and send again. A template field value is Name FieldValues with the template field in FieldId, one entry per failing field.

      When it is present. Only when the refusal points at something the partner fixes in a form, and then every such refusal carries it: - UpdateCampaignAsset: FieldValues (including a file the content scan declined, which is why a partner handles image failures and text failures the same way, through this list), Layout, SendMode and ScheduledSendAt; - CreateCampaign and UpdateCampaign: campaign settings and files; - GetCampaignTemplate: Identifier.

      Every other ValidationException carries Message only — tags, ARNs, social connections, exports, and CAMPAIGN_INCOMPLETE, whose missing settings are not members of the request it refuses.

      • (dict) –

        A field that failed validation.

        • Name (string) –

          The member of the request that failed, as the request names it: FieldValues for a template field value, Layout, EmailTarget, Identifier, and so on. It is never a template field id: a template field is always FieldValues, with the field in FieldId.

        • FieldId (string) –

          The template field that failed, when Name is FieldValues; absent otherwise.

        • Message (string) –

          Why this field failed, in prose a partner can be shown directly.

        • Code (string) –

          Why this field failed, as a value a client branches on. Read this rather than Message.

    • Error (dict) – Normalized access to common exception attributes.

      • Code (string) – An identifier specifying the exception type.

      • Message (string) – A descriptive message explaining why the exception occured.