Skip to content

Extend exception handling #1884

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

Merged
merged 7 commits into from
Jun 21, 2025
Merged

Conversation

bombsimon
Copy link
Contributor

  • Exception handling can handle multiple WHEN arms
  • Exception can re-raise with RAISE keyword
  • Snowflake can now also parse BEGIN ... EXCEPTION ... END

Example:

BEGIN
    SELECT 1;
EXCEPTION
    WHEN EXCEPTION_1 THEN
        SELECT 1;
    WHEN EXCEPTION_2 OR EXCEPTION_3 THEN
        SELECT 2;
        SELECT 3;
    WHEN OTHER THEN
        SELECT 4;
RAISE;
END;

- Exception handling can handle multiple `WHEN` arms
- Exception can re-raise with `RAISE` keyword
- Snowflake can now also parse `BEGIN ... EXCEPTION ... END`

Example:

```sql
BEGIN
    SELECT 1;
EXCEPTION
    WHEN EXCEPTION_1 THEN
        SELECT 1;
    WHEN EXCEPTION_2 OR EXCEPTION_3 THEN
        SELECT 2;
        SELECT 3;
    WHEN OTHER THEN
        SELECT 4;
RAISE;
END;
```
@bombsimon bombsimon force-pushed the begin-exception-end branch from 6f5fe30 to 6126320 Compare June 12, 2025 15:11
@bombsimon bombsimon requested a review from iffyio June 16, 2025 16:17
@bombsimon bombsimon requested a review from iffyio June 17, 2025 13:07
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @bombsimon!
cc @alamb

@iffyio iffyio merged commit 204d3b4 into apache:main Jun 21, 2025
18 checks passed
@iffyio iffyio deleted the begin-exception-end branch June 21, 2025 06:12
@alamb
Copy link
Contributor

alamb commented Jun 21, 2025

🚀

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

Successfully merging this pull request may close these issues.

3 participants