Skip to content

Better exception descriptions #1411

@antonioan

Description

@antonioan

Is your feature request related to a problem? Please describe.

  1. Trying to name a function get fails with
pdl.pdl_ast.PDLRuntimeError: Type error: ${utils.get} is of type <class 'builtin_function_or_method'> but should be a function.
  1. Accidentally indenting the with: when match: is empty, i.e.,
  match:
    with:
# ^^ <- wrong 
      - if: condition
        then: result
      - then: default

fails with the vague exception:

['utils.pdl:0 - Missing required field: function', 'utils.pdl:0 - Missing required field: return', "utils.pdl:11 - {'temperature': '${temperature}', 'top_p': '${top_p}'} should be of type: {'anyOf': [{'$ref': '#/$defs/LocalizedExpression_TypeVar_'}... (truncated)
  1. Accidentally using the keyword dict instead of object to describe an (optional) function parameter type fails with the same vague exception above.

Describe the solution you'd like

A clearer and more concise description of what went wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions