Skip to content

[RFC0017] Add invalid and missingerror values#673

Merged
jrentlez merged 22 commits intomainfrom
rfc17-implementation
Aug 26, 2025
Merged

[RFC0017] Add invalid and missingerror values#673
jrentlez merged 22 commits intomainfrom
rfc17-implementation

Conversation

@jrentlez
Copy link
Copy Markdown
Contributor

@jrentlez jrentlez commented Aug 4, 2025

Depends on #674.

This PR implements RFC0017, accepted in #670.

Also included is a restructuring of PostgresLoaderExecutor with a more granular try/catch.

Reason for the draft status: The RFC states that a log message must be emitted every time an error is assigned to a variable. I still need to make sure that is actually the case in the implementation

Edit: sorry for the large diff

@jrentlez jrentlez self-assigned this Aug 4, 2025
@jrentlez jrentlez added the enhancement New feature or request label Aug 4, 2025
@jrentlez jrentlez requested a review from georg-schwarz August 4, 2025 08:16
@georg-schwarz georg-schwarz requested a review from Copilot August 4, 2025 13:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements RFC0017 by introducing invalid and missing error values to represent failed evaluations instead of returning undefined. The implementation adds new error classes (InvalidError and MissingError) and replaces undefined returns throughout the codebase with these error objects. Additionally, it includes a restructuring of PostgresLoaderExecutor with more granular error handling.

  • Introduces new error types InvalidError and MissingError with corresponding type guards
  • Replaces undefined returns with error objects throughout expression evaluation and property handling
  • Updates all value type classes to handle error representations in type checking methods
  • Restructures PostgresLoaderExecutor with granular try/catch blocks for better error isolation

Reviewed Changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
libs/language-server/src/lib/ast/expressions/internal-value-representation.ts Defines new error classes and updates internal value representation types
libs/language-server/src/lib/ast/expressions/typeguards.ts Adds type guards for error detection and removes unused helper function
libs/language-server/src/lib/ast/expressions/evaluate-expression.ts Updates expression evaluation to return errors instead of undefined
libs/language-server/src/lib/ast/wrappers/value-type/value-type.ts Updates ValueType interface to handle error representations
libs/language-server/src/lib/validation/validation-util.ts Replaces undefined check with error type guard
libs/extensions/rdbms/exec/src/lib/postgres-loader-executor.ts Restructures with granular error handling methods
Comments suppressed due to low confidence (2)

libs/language-server/src/lib/ast/expressions/typeguards.ts:69

  • [nitpick] The function name ERROR_TYPEGUARD is inconsistent with the pattern of other type guards. Consider renaming to ERROR_TYPEGUARD or isError for better consistency with other type guard naming conventions.
export const ERROR_TYPEGUARD = (

libs/extensions/rdbms/exec/src/lib/postgres-loader-executor.ts:61

  • The method name createError is ambiguous. Consider renaming to createExecutionError or formatDatabaseError to better indicate it creates a Result with error information, not just an Error object.
  private createError(

Copy link
Copy Markdown
Member

@georg-schwarz georg-schwarz left a comment

Choose a reason for hiding this comment

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

Very nice progress! Left some comments to discuss and/or address ;-)

@jrentlez jrentlez force-pushed the rfc17-implementation branch from 77bac31 to fcd4187 Compare August 4, 2025 14:22
@jrentlez jrentlez marked this pull request as ready for review August 10, 2025 09:26
@jrentlez jrentlez requested a review from georg-schwarz August 10, 2025 09:26
@jrentlez jrentlez force-pushed the rfc17-implementation branch from 18c2c2e to 553baeb Compare August 11, 2025 17:16
Copy link
Copy Markdown
Member

@georg-schwarz georg-schwarz left a comment

Choose a reason for hiding this comment

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

Phew, what a great addition! Left some minor comments you can address if you want. Aside from that, ready to merge from my side!

@jrentlez jrentlez merged commit 42289a9 into main Aug 26, 2025
4 checks passed
@jrentlez jrentlez deleted the rfc17-implementation branch August 26, 2025 11:52
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants