Classes Implementing a trait throw errors from lines that don't exist

Closed
#1,557 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #1566 by @DuBearte — merged

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start with the attached minimal reproduction project and trace how trait methods map runtime errors to source locations in the engine. Reproduce the error in the debugger, then follow the relevant trait and error-reporting entry points to see why the reported line falls past the class script. Done when the debugger points to the trait line that caused the runtime error.

Written by the indexing model from the issue text.

Description

bug topic:gdscript usability
Tested versions

26.3

System information

GDScript

Issue description

When a class pulls in a trait and that trait causes a runtime error, the error is reported in the debugger as coming from a nonexistent line off the end of the class script. It somehow needs to be reported as caused by the trait in order to point to the line that actually caused the error.

Steps to reproduce
  1. Write a trait with a method that throws an error when called, such as calling a method on a null instance
  2. Write a class that uses the trait.
  3. Call the error method.

Alternatively, run the MRP and observe the error.

Minimal reproduction project (MRP)

trait-wreck.zip
trait-wreck.tar.gz

Dominant language
C++
Stars
6.1k
Forks
337
Avg merge
4d 5h
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Redot-Engine/redot-engine

All issues in Redot-Engine/redot-engine

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.