"""Generic error messages.""" from ledger.constants.constants import SUBLEDGER_EVENT_MAPPING ERROR_CODE_AUTHORIZATION = 'authorization_error' ERROR_CODE_BAD_GRASS_REQUEST = 'bad_grass_request_error' ERROR_CODE_FORBIDDEN = 'forbidden' ERROR_CODE_NOT_FOUND = 'not_found' ERROR_CODE_UNAUTHORIZED_ACCOUNT = 'Unauthorized to access account' 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_ENTITY_DOES_NOT_EXIST = '{object_type} {object_id} does not exist.' ERROR_INVALID_MODEL_TYPE = 'Model type must be {ledger_type}' ERROR_UNKNOWN_CURRENCY = 'Currency code not recognized: {code}' ERROR_UNKNOWN_CURRENCY_FOR_FIELD = ( 'Currency code {code} not recognized for the field {field}' ) ERROR_INVALID_BULK_DATA = 'Invalid bulk data: {error}' ERROR_APPLY_SOFT_DELETED_WORKSHEET_ADJUSTMENT = ( 'Cannot apply: a referenced worksheet_adjustment was soft-deleted ' 'concurrently (rejected by the database guard).' ) ERROR_INVALID_SYNTAX = 'Invalid syntax' ERROR_MIN_RECORDS = 'At least one record is required.' ERROR_COUNTRY_CODE_REQUIRED = 'Country code is required' ERROR_UNKNOWN_COUNTRY = 'Country code not recognized: {code}' INVALID_VAT_CATEGORY = 'Vat Category must be of {VAT_CATEGORIES_OLD}' ERROR_INVALID_STATEMENT_PERIOD_RANGE = ( 'Please enter a valid range of statement periods.' ) ERROR_EXCHANGE_RANGE_NOT_PROVIDED = 'Please provide exchange rate.' ERROR_RECORD_ALREADY_EXISTS = 'A record with fields {} already exists.' ERROR_POST_REQUEST_DUPLICATE_RECORDS = ( 'A POST request contains duplicate records with fields {}.' ) ERROR_LEDGER_CORRECTION_RECORD_ALREADY_EXISTS = ( "The records for worksheet_correction_id's {} already exists." ) ERROR_LEDGER_CONTRACT_ADVANCE_APPLIED_DOES_NOT_EXIST = ( 'Specified ledger_contract_advance_applied record does not exist.' ) ERROR_WORKSHEET_WITH_AMOUNTS_IS_REQUIRED = 'Worksheet with amounts is required' ERROR_LEDGER_ACCOUNT_ENTRY_DOES_NOT_EXIST = ( f'Invalid entry_type. Must be one of {list(SUBLEDGER_EVENT_MAPPING.keys())}' ) ERROR_LEDGER_SAVE = 'Error saving ledger entries.' ERROR_INTEGRITY = 'IntegrityError: Cannot add or update a child row' ERROR_LEDGER_INVALID_STATEMENT_PERIOD_IDS = 'Invalid statement period ids are passed.' ERROR_LEDGER_INVALID_CONTRACT_IDS = 'Invalid contract ids are passed.' ERROR_INTEGRITY_CONFLICT = 'Conflict: a database constraint was violated' ERROR_INVALID_DATA = 'Invalid data: a value is out of range or too long'