Skip to content

Better runtime execution tracebacks #192

@kindermax

Description

@kindermax

Case - when there is no entity in database but link still returns entity id, later in Node field mapper we receive None, hence AttributeError: 'NoneType' object has no attribute 'get_key'

We need to make this errors/traceback better. At least we must see some execution info suck as query/node/field/mapper etc.

Traceback

Traceback (most recent call last):
  # File "/usr/local/lib/python3.13/dist-packages/app/controllers/graph.py", line 95, in wrapper
    return func(*args, **kwargs)
  File "<decorator-gen-0>", line 2, in graphql
  File "/usr/local/lib/python3.13/dist-packages/app/controllers/graph.py", line 72, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/dist-packages/app/controllers/graph.py", line 189, in graphql
    return loop.run_until_complete(
           ~~~~~~~~~~~~~~~~~~~~~~~^
        endpoint.dispatch(request_data)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/dist-packages/app/lib/graph/endpoint.py", line 106, in dispatch
    return await self.dispatch(data, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/dist-packages/app/lib/util_graph.py", line 118, in dispatch
    return await super().dispatch(data, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/dist-packages/hiku/endpoint/graphql.py", line 170, in dispatch
    return await super(AsyncGraphQLEndpoint, self).dispatch(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        data, context
        ^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/dist-packages/hiku/endpoint/graphql.py", line 101, in dispatch
    result = await self.schema.execute(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/dist-packages/hiku/schema.py", line 209, in execute
    result = await self.engine.execute(execution_context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/dist-packages/hiku/executors/asyncio.py", line 56, in process
    queue.progress(done)
    ~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/dist-packages/hiku/executors/queue.py", line 117, in progress
    callback()
    ~~~~~~~~^^
  File "/usr/local/lib/python3.13/dist-packages/hiku/engine.py", line 853, in callback
    proc(),
    ~~~~^^
  File "/usr/local/lib/python3.13/dist-packages/hiku/telemetry/prometheus.py", line 183, in proc_wrapper
    result = result_proc()
  File "/usr/local/lib/python3.13/dist-packages/hiku/sources/graph.py", line 60, in result_proc
    proc(this, sq_result, *opt_args)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<expr>", line 1, in <lambda>
  File "/usr/local/lib/python3.13/dist-packages/app/lib/graph/construct.py", line 232, in get_enum_key
    return enum_value.get_key()
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_key'

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