Skip to content

Improvement for error messages on TypeErrors #8

@BMaxV

Description

@BMaxV

I ran into this problem and the problem isn't the actual error

File "/home/max/Documents/Python/panda_random_experiments/3d_editor/main.py", line 439, in set_vertex_color_red
   vertex = GeomVertexRewriter(vdata)# 'vertex')
            ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Arguments must match:
GeomVertexRewriter()
GeomVertexRewriter(GeomVertexArrayData array_data)
GeomVertexRewriter(GeomVertexData vertex_data)
GeomVertexRewriter(Thread current_thread)
GeomVertexRewriter(GeomVertexData vertex_data, const InternalName name, Thread current_thread)
GeomVertexRewriter(GeomVertexArrayData array_data, int column, Thread current_thread)
GeomVertexRewriter(GeomVertexArrayData array_data, Thread current_thread)
GeomVertexRewriter(GeomVertexData vertex_data, Thread current_thread)

The python interpreter gives very good error messages by default now.

Python 3.12.3 (main, Nov  6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> "a"+1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "int") to str

Mentioning not just the expected but also the wrong type. It would be nice if panda3d / interrogate could do the same.

Definitely "nice to have" though, I can find out what wrong type I'm using without this, I will just have to investigate a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions