Skip to content

Conversation

@vertti
Copy link
Collaborator

@vertti vertti commented Sep 21, 2025

Overview

This PR enhances exception messages in daffy's DataFrame validation decorators to provide clearer debugging information by including function names and explicitly identifying return value validation failures.

Changes Made

Function Name in Exception Messages

  • Exception messages now include the function name where validation failed
  • Helps developers quickly identify which function is causing validation issues in large codebases

Before:
AssertionError: Missing columns: ['Price'] in parameter 'df'. Got columns: ['Brand']

After:
AssertionError: Missing columns: ['Price'] in function 'process_cars' parameter 'df'. Got columns: ['Brand']

Clear Return Value Validation Messages

  • Return value validation failures now explicitly state "return value"
  • Eliminates confusion between parameter validation and return value validation failures

Before:
AssertionError: Missing columns: ['Price'] in function 'get_cars'. Got columns: ['Brand']

After:
AssertionError: Missing columns: ['Price'] in function 'get_cars' return value. Got columns: ['Brand']

  Exception messages now include the function name where validation failed, making debugging easier. The messages follow the format: Missing columns: [...] in function 'function_name' parameter 'param_name'
  Exception messages for return value validation now explicitly state 'return value' instead of just showing the function name. This makes it clearer when validation fails on function outputs versus inputs
@vertti vertti merged commit b86ac37 into ThoughtWorksInc:master Sep 21, 2025
5 checks passed
@vertti
Copy link
Collaborator Author

vertti commented Sep 21, 2025

Closes #32

@vertti vertti deleted the improved-error-messages branch September 21, 2025 14:26
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.

1 participant