Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling #28

Open
elliotchance opened this issue Jul 14, 2019 · 0 comments
Open

Error handling #28

elliotchance opened this issue Jul 14, 2019 · 0 comments
Milestone

Comments

@elliotchance
Copy link
Owner

Still trying to work out what error handling will look like, here is a rough idea:

start:
    declare last-order-date is text

    # one line
    try to fetch last order date into last-order-date, on no-orders set last-order-date to "unknown", on missing-order display error-message, always display "Fetched order date"

    # one line with better spacing
    try to fetch last order date into last-order-date,
        on no-orders set last-order-date to "unknown",
        on missing-order display error-message,
        always display "Fetched order date"

    # multiline
    try
        fetch last order date into last-order-date
        display "Fetched order date"
    catch no-orders, set last-order-date to "unknown"
    catch missing-order do
        display error-message
    end

fetch last order date into dest (dest is text):
    raise error no-orders
    raise error missing-order with the message "Where did it go?"
@elliotchance elliotchance added this to the Future milestone Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant