Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

missing variable exception #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

missing variable exception #6

wants to merge 1 commit into from

Conversation

litwisha
Copy link

Added MissingVariableException exception.
User-defined variables can raise this exception, just in case, if the variable value is missing.
If the exception was raised, than corresponding conditions are negative(false).

Example:
we have an order, and each order has payment attribute, which contains payment country.

class Payment:
    type: str
    country: str
    
class Order:
    payment: Payment = None

we have 3 orders with corresponding payments:

  1. Payment(country='DE')
  2. Payment(country='AT')
  3. none

if we have a condition: payment_country != 'DE', than in this case 2-3 orders will return True, but 3rd order has no payment.

Situations depend on business logic, so MissingVariableException will give more flexibility to user.

@litwisha litwisha requested a review from butsyk September 28, 2020 14:50
@litwisha litwisha self-assigned this Sep 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant