"""Generic error messages.""" ERROR_CODE_AUTHORIZATION = 'authorization_error' ERROR_CODE_BAD_GRASS_REQUEST = 'bad_grass_request_error' ERROR_CODE_NOT_FOUND = 'not_found' ERROR_CODE_MISSING_QUERY_PARAM = 'missing_query_param' ERROR_CODE_INVALID_HEADER = 'invalid_header_error' ERROR_CODE_QUERY_VALIDATION = 'error_query_validation' ERROR_CODE_INVALID_INPUT = 'invalid_input' ERROR_MESSAGE_MISSING_GRASS_HEADERS = 'Missing Grass Headers' ERROR_MESSAGE_INCOMPLETE_GRASS_HEADERS = 'Incomplete Grass Headers' ERROR_MESSAGE_INVALID_GRASS_ACCOUNT_TYPE = 'Invalid Grass Account Type' ERROR_MESSAGE_FORBIDDEN_USER = 'User is forbidden' ERROR_MESSAGE_TRACK_NOT_FOUND = 'Track not found' ERROR_MESSAGE_TRACK_SAMPLE_NOT_FOUND = 'Track Sample not found' ERROR_MESSAGE_MISSING_ORCHARD_USER_ID = 'Missing Orchard User Id' ERROR_MESSAGE_CALL_NOT_ALLOWED = 'Only calls from microservices are allowed' ERROR_MESSAGE_MISSING_ORCHARD_IDENTITY_ID = 'Missing Orchard Identity Id' ERROR_MESSAGE_UNABLE_TO_CLAIM_ISRC = 'Unable to claim an ISRC.' ERROR_MESSAGE_INVALID_DATALOAD = 'Invalid payload for dataloader' ERROR_MESSAGE_TRACK_SPATIAL_NOT_FOUND = 'Track Spatial not found' ERROR_MESSAGE_TRACK_SPATIAL_ALREADY_EXISTS = 'Track Spatial already exists' ERROR_CODE_TRACK_SPATIAL_ALREADY_EXISTS = 'track_spatial_already_exists' SUCCESS_CODE = 'ok' # Generic Validation BAD_REQUEST_CODE = 'bad_request' VALIDATION_ERROR_CODE = 'validation_error' VALIDATION_ERROR_MSG = 'Invalid data passed' INVALID_VALUE_ERROR_CODE = 'invalid_value' INTERNAL_ERROR = 'Internal server error' # Race-Condition Errors TOO_MANY_WRITES_CODE = 'too_many_writes' TOO_MANY_WRITES_MSG = ( 'Too many write requests were made for one or more tracks. ' 'Please limit to one write request at a time.') # Specific Validation Error Messages ERROR_ACCOUNT_DATA_CODE = 'account_data_error' ERROR_ACCOUNT_DATA_REQUIRED_MSG = '`account_type` and `account_id` must ' \ + 'be passed in either using Grass Headers or Query Parameters' VALIDATION_ERROR_INVALID_PRODUCT_ID_MSG = \ 'A positive integer must be passed in for `product_id`' VALIDATION_ERROR_INVALID_FIELD_MSG = \ 'Field `{}` is invalid' VALIDATION_ERROR_SUPERFLUOUS_FIELD_MSG = \ '`{}` field cannot be set using this endpoint' VALIDATION_ERROR_MISSING_FIELD_MSG = \ 'Field `{}` is required' VALIDATION_ERROR_BLANK_NAME_MSG = \ '{} name cannot be blank' VALIDATION_ERROR_IMMUTABLE_FIELD_MSG = \ 'Field `{}` cannot be overwritten with a new value' VALIDATION_ERROR_OPTIONAL_INT_MSG = \ '`{}` must be an integer if specified' VALIDATION_ERROR_DUPLICATE_DATA_MSG = \ 'Duplicate data was found' VALIDATION_ERROR_INVALID_TRACK_FOUND_MSG = \ 'Data was found for tracks not belonging to this product' VALIDATION_ERROR_BAD_LOCALIZATION_DATA_MSG = \ 'Localization data is invalid' VALIDATION_ERROR_ROLE_LOCALIZATIONS_MISMATCH_MSG = \ 'Each {} must have a localization (when localizations are provided)' VALIDATION_ERROR_ROLE_ARTISTS_ONLY_LOCALIZATIONS_MSG = \ 'Localizations can only be applied to artist roles' VALIDATION_ERROR_LOCALIZATION_REQUIRED = ( 'Please select {} as a localization. ' 'Both variations of the Chinese written languages ' 'are required for delivery.') VALIDATION_ERROR_BOTH_CHINESE_LANGS_REQUIRED = ( 'Simplified and Traditional variations are required ' 'when delivering Chinese content. ' 'One can be entered as the meta language ' 'while adding the other as a localization ' 'or both can be entered as localizations.') VALIDATION_ERROR_FIELD_TOO_LONG = "Field {} can't be more than 200 characters" VALIDATION_ERROR_COMBINED_FIELDS_TOO_LONG = ( 'Combined Work + Movement fields can be at most 250 characters') INVALID_META_LANGUAGE_MSG = ( 'Metalanguage must be a valid value ' 'and not conflict with an existing localization') INVALID_FOCUS_TRACK_INPUT_MSG = ( 'Track must be a focus track if updating values') INVALID_FOCUS_TRACK_DATE_RANGE_ALREADY_EXISTS_MSG = ( 'Focus track range overlaps other tracks') META_LANGUAGE_APPLY_TO_ALL_CONFLICT_MSG = ( 'Cannot update Metalanguage for a track since it has a conflicting ' 'localization language') LOCALIZATION_ERROR_TOO_MANY_LOCALIZATIONS = ( 'At most 5 localizations are allowed for each track.') LOCALIZATION_ERROR_LOCALIZED_VALUES_MISMATCH = ( 'Localized field must have ' 'the same number of localized values as in the master field') INVALID_PREVIEW_START_TIME_MSG = 'Invalid preview start point' INVALID_OWNERSHIP_TYPE_MSG = ( 'Ownership Type must be null or one of the following: {}') # Invalid role Error INVALID_ROLE_ERROR_CODE = 'invalid_role' INVALID_ROLE_ERROR_MSG = 'Role `{}` is invalid' # Invalid Artist Type Error INVALID_ARTIST_TYPE_ERROR_MSG = 'Artist type `{}` is invalid' # Invalid Artist Name Error INVALID_ARTIST_NAME_ERROR_MSG = 'Artist name `{}` is invalid' MISSING_ARTIST_TYPE = 'Artist types `{}` are missing' # Required Error REQUIRED_CODE = 'required' # Invalid Error INVALID_CODE = 'invalid' # Duplicate Error DUPLICATE_CODE = 'duplicate' DUPLICATE_MSG = 'Duplicate data found for field `{}`' # Used for track ordering ERROR_NOT_UNIQUE_CODE = 'not_unique' ERROR_SEQ_INTEGRITY_CODE = 'sequence_integrity' ERROR_SEQ_RANGE_CODE = 'sequence_range' VALIDATION_DUPLICATE_TRACKS_ERROR_MSG = \ 'Duplicate tracks' VALIDATION_SEQ_INTEGRITY_ERROR_MSG = \ 'Missing volumes or track numbers' VALIDATION_SEQ_RANGE_ERROR_MSG = \ 'Volumes or track numbers out of range' # A dict of error codes to messages for track order ERROR_TRACK_ORDER_CODE_TO_MSG = { VALIDATION_ERROR_CODE: VALIDATION_ERROR_MSG, ERROR_NOT_UNIQUE_CODE: VALIDATION_DUPLICATE_TRACKS_ERROR_MSG, ERROR_SEQ_INTEGRITY_CODE: VALIDATION_SEQ_INTEGRITY_ERROR_MSG, ERROR_SEQ_RANGE_CODE: VALIDATION_SEQ_RANGE_ERROR_MSG } # External service error codes OWS_PERMISSIONS_ERROR_CODE = 'ows_permissions_error' OWS_PRODUCT_ERROR_CODE = 'ows_product_error' OWS_PRODUCT_FAILED_TO_DELETE_LOCALIZATIONS_MSG = \ 'Failed to delete track localizations:' OWS_PRODUCT_FAILED_TO_UPDATE_LOCALIZATIONS_MSG = \ 'Failed to update tracks localizations:' OWS_PRODUCT_FAILED_TO_GET_LOCALIZATIONS_MSG = 'Failed to get localizations' OWS_PRODUCT_FORBIDDEN_MESSAGE = 'User is forbidden' OWS_PRODUCT_NO_PRODUCT_ID_MESSAGE = '`product_id` is required in the request' OWS_PRODUCT_DIGITAL_ERROR_CODE = 'ows_product_digital_error' OWS_LYRICS_ERROR_CODE = 'ows_lyrics_error' OWS_VIDEO_ERROR_CODE = 'ows_video_error' OWS_ASSETS_ERROR_CODE = 'ows_assets_error' OWS_CONTRACTS_ERROR_CODE = 'ows_contracts_error' OWS_CARVEOUTS_ERROR_CODE = 'ows_carveouts_error' ASSET_STATUS_MISSING = 'asset status is missing' OWS_PRODUCT_FAILED_TO_GET_LOCALIZATION_LANGS_MSG = \ 'Failed to get localization languages' OWS_PRODUCT_FAILED_TO_DELETE_LYRICS_MSG = \ 'Failed to delete track lyrics:' OWS_PRODUCT_FAILED_TO_DISASSOCIATE_VIDEO_TRACKS_MSG = \ 'Failed to disassociate tracks from video products:' OWS_PRODUCT_FAILED_TO_DELETE_SAMPLES_MSG = \ 'Failed to delete track samples:' OWS_SOUND_RECORDINGS_ERROR = 'ows_sound_recordings_error' OWS_BLACKLIST_MANAGER_ERROR = 'ows_blacklist_manager_error' OWS_ACCOUNT_ERROR_CODE = 'ows_account_error' # Handler-layer request validations ERROR_CODE_REQUEST_BODY = 'request_body_error' ERROR_MESSAGE_MISPLACED_PARAM = \ 'The request body contains an invalid parameter' TRACK_AUDIT_MODEL_CREATION_ERROR = 'track_audit_model_creation_error' TRACK_AUDIO_ATTRIBUTE_MODEL_ERROR = 'track_audio_attribute_model_error' TRACK_AUDIO_ATTRIBUTE_EDITS_MODEL_ERROR = 'track_audio_attribute_edits_model_error' TRACK_RIGHTS_ATTRIBUTE_EDITS_MODEL_ERROR = 'track_rights_attribute_edits_model_error' # Copy tracks error COPY_TRACKS_ERROR_CODE = 'copy_tracks_error' COPY_TRACKS_ERROR_MESSAGE = 'Failed to clone tracks for products' # Performer-related errors NO_PRIMARY_PERFORMER_MSG = ( 'Track must have one `primary` performer') # Instant Grats related errors INSTANT_GRATS_NOT_FOUND_MSG = ( 'Instant Grats for provided tracks do not exist') NO_SUCH_TRACKS_IN_PRODUCT_MSG = ( '`{}` tracks do not exist in this product.') VALIDATION_ERROR_INVALID_STORES_PROVIDED = ( 'Stores {} are not allowed for Instant Grats') VALIDATION_ERROR_IG_DATE_OUT_OF_RANGE_MSG = ( 'Instant grats date must be on or after the pre-order date ' 'and before the sale start date.') VALIDATION_ERROR_IG_PRODUCT_DATES_UNAVAILABLE_MSG = ( 'Unable to validate instant grats date: product date information is unavailable.') VALIDATION_ERROR_CHINESE_LOCALIZATION_REQUIRED = ( 'Please select {track_language} as a localization, ' 'as {product_meta_language} is already selected as the product ' 'metadata language. Both variations of the ' 'Chinese written language are required for delivery.') VALIDATION_ERROR_SIMILAR_LOCALIZATION = ( 'Localization language cannot be the same as {} meta language.' ) EMPTY_PRODUCER_NAME_ERROR = 'Producer name is empty' # validator error codes MISSING_COMPOSER = 'missing_composer' MISSING_PERFORMER = 'missing_performer' MISSING_WORK = 'missing_work' MISSING_TRACK_NAME = 'missing_track_name' MISSING_META_LANGUAGE_CODE = 'missing_meta_language_code' MISSING_ISRC = 'missing_isrc' EXCESSIVE_ISRC_REUSE = 'excessive_isrc_reuse' POTENTIAL_AUDIO_INFRINGEMENT = 'potential_audio_infringement' AI_GENERATED_AUDIO = 'ai_generated_audio' SPOTIFY_WATCHLIST_ARTIST = 'spotify_watchlist_artist' MISSING_P_INFO = 'missing_p_info' MISSING_EXPLICIT = 'missing_explicit' MISSING_OWNERSHIP_RIGHTS = 'missing_ownership_rights' MISSING_RECORDING_COUNTRY_ID = 'missing_recording_country_id' MISSING_ORIGINAL_RIGHTS_HOLDER_COUNTRY_ID = 'missing_original_rights_holder_country_id' # noqa MISSING_WRITERS = 'missing_writers' MISSING_PRODUCERS = 'missing_producers' MISSING_ASSET_STATUS = 'missing_asset_status' MISSING_AUDIO_FILE = 'missing_audio_file' MISSING_ATMOS_AUDIO_FILE = 'missing_atmos_audio_file' MISSING_SPATIAL_ISRC = 'missing_spatial_isrc' MISSING_LANGUAGE = 'missing_language' MISSING_PRIMARY_PERFORMER = 'missing_primary_performer' MISSING_BIRTH_NAME = 'missing_birth_name' MISSING_CHINESE_LOCALIZATION = 'missing_chinese_localization' MISSING_BOTH_CHINESE_LANGUAGES = 'missing_both_chinese_languages' FEATURED_ARTIST_MISMATCH = 'featured_artist_mismatch' MISSING_US_PUBLISHING_OBLIGATION = 'missing_us_publishing_obligation' MISSING_THIRD_PARTY_PUBLISHER = 'missing_third_party_publisher' MISSING_PUBLISHER_NAMES = 'missing_publisher_names' INVALID_ISRC = 'invalid_isrc' UNEXPECTED_SPATIAL_ISRC = 'unexpected_spatial_isrc' INVALID_SPATIAL_ISRC_MSG = 'This spatial ISRC is invalid.' UNEXPECTED_SPATIAL_ISRC_MSG = 'Spatial ISRC is set but no Dolby Atmos file is present.' ATMOS_ENCODING_NOT_COMPLETED_MSG = 'Atmos audio file encoding is not completed.' INVALID_P_INFO = 'invalid_p_info' INVALID_PREVIEW_START_TIME = 'invalid_preview_start_time' INVALID_LANGUAGE = 'invalid_language' INVALID_PERFORMER_TYPE = 'invalid_performer_type' TRACK_NAME_VERSION_ALREADY_IN_USE = 'track_name_version_already_in_use' TRACK_NAME_VERSION_COMPOSER_CLASSICAL_ALREADY_IN_USE = 'track_name_version_composer_classical_already_in_use' EMPTY_ARTIST_NAME = 'empty_artist_name' EMPTY_PRODUCER_NAME = 'empty_producer_name' GENRE_ARTIST_MISMATCH = 'genre_artist_mismatch' CANNOT_BE_LOCALIZED = '{field_name}_cannot_be_localized' MAX_LENGTH_EXCEEDED = '{field_name}_max_length_exceeded' LOCALIZED_ARTISTS_MISMATCH = 'localized_artists_mismatch' TOO_MANY_LOCALIZATIONS = 'too_many_localizations' SINGLE_TRACK_NAME_MUST_MATCH_PRODUCT_NAME = 'single_track_name_must_match_product_name' SINGLE_TRACK_NAME_MUST_MATCH_PRODUCT_NAME_MSG = 'The track name must match the product name for a single track product' SINGLE_TRACK_VERSION_MUST_MATCH_PRODUCT_VERSION = 'single_track_version_must_match_product_version' SINGLE_TRACK_VERSION_MUST_MATCH_PRODUCT_VERSION_MSG = \ 'The track version must match the product version for a single track product' SINGLE_TRACK_PRIMARY_ARTISTS_MUST_MATCH_PRODUCT_PRIMARY_ARTISTS = \ 'single_track_primary_artists_must_match_product_primary_artists' SINGLE_TRACK_PRIMARY_ARTISTS_MUST_MATCH_PRODUCT_PRIMARY_ARTISTS_MSG = \ "The track's primary artist(s) must match the product's primary artist(s) for a single track product" SINGLE_TRACK_FEATURING_ARTISTS_MUST_MATCH_PRODUCT_FEATURING_ARTISTS = \ 'single_track_featuring_artists_must_match_product_featuring_artists' SINGLE_TRACK_FEATURING_ARTISTS_MUST_MATCH_PRODUCT_FEATURING_ARTISTS_MSG = \ "The track's featuring artist(s) must match the product's featuring artist(s) for a single track product" SINGLE_TRACK_COMPOSERS_MUST_MATCH_PRODUCT_COMPOSERS = \ 'single_track_composers_must_match_product_composers' SINGLE_TRACK_COMPOSERS_MUST_MATCH_PRODUCT_COMPOSERS_MSG = \ "Product and Track Composer must be the same for single track products." SINGLE_TRACK_ORCHESTRAS_MUST_MATCH_PRODUCT_ORCHESTRAS = \ 'single_track_orchestras_must_match_product_orchestras' SINGLE_TRACK_ORCHESTRAS_MUST_MATCH_PRODUCT_ORCHESTRAS_MSG = \ "Product and Track Orchestra(s) must be the same for single track products." SINGLE_TRACK_CONDUCTORS_MUST_MATCH_PRODUCT_CONDUCTORS = \ 'single_track_conductors_must_match_product_conductors' SINGLE_TRACK_CONDUCTORS_MUST_MATCH_PRODUCT_CONDUCTORS_MSG = \ "Product and Track Conductor(s) must be the same for single track products." SINGLE_TRACK_ENSEMBLES_MUST_MATCH_PRODUCT_ENSEMBLES = \ 'single_track_ensembles_must_match_product_ensembles' SINGLE_TRACK_ENSEMBLES_MUST_MATCH_PRODUCT_ENSEMBLES_MSG = \ "Product and Track Ensemble(s) must be the same for single track products." TRACK_ARTISTS_VALIDATORS = { 'composer': 'stComposerMismatch', 'orchestra': 'stOrchestraMismatch', 'conductor': 'stConductorMismatch', 'ensemble': 'stEnsembleMismatch' } TRACK_ARTISTS_ERRORS = { 'composer': SINGLE_TRACK_COMPOSERS_MUST_MATCH_PRODUCT_COMPOSERS, 'orchestra': SINGLE_TRACK_ORCHESTRAS_MUST_MATCH_PRODUCT_ORCHESTRAS, 'conductor': SINGLE_TRACK_CONDUCTORS_MUST_MATCH_PRODUCT_CONDUCTORS, 'ensemble': SINGLE_TRACK_ENSEMBLES_MUST_MATCH_PRODUCT_ENSEMBLES } TRACK_ARTISTS_MESSAGES = { 'composer': SINGLE_TRACK_COMPOSERS_MUST_MATCH_PRODUCT_COMPOSERS_MSG, 'orchestra': SINGLE_TRACK_ORCHESTRAS_MUST_MATCH_PRODUCT_ORCHESTRAS_MSG, 'conductor': SINGLE_TRACK_CONDUCTORS_MUST_MATCH_PRODUCT_CONDUCTORS_MSG, 'ensemble': SINGLE_TRACK_ENSEMBLES_MUST_MATCH_PRODUCT_ENSEMBLES_MSG }