IppClub / IppClub/YueScript

[Bug] yue.require does not propagate errors to Lua

Open
#183 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
613
Forks
45
PR merge metrics
No merged PRs in 30d

Description

The YueScript documentation says to use yue.require() to perform custom error handling:

local yue = require("yue")
local success, result = xpcall(function()
    yue.require("yuescript_module_name")
end, function(err)
    return yue.traceback(err)
end)

However, this does not work. When throwing an error in a .yue file, the call to yue.require() will not fail and just return nothing. The error handler defined here will not be called, either. Furthermore, yue.require() always prints a traceback with yue.traceback().

Image

The screenshot shows a file called temp.yue that contains the following code:





const f = () ->
	error("Test message")



f()



It is being executed with LuaJIT, with the following code:

yue = require("yue")
print(pcall(yue.require, "temp"))

The output is:

Test message
Stack Traceback
===============
(1) '=(yuescript)':172
(2) global C function 'pcall'
(3) '=stdin':1
(4)  C function 'function: 0x7e8c2865c588'

true nil

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by reproducing the issue with the shown LuaJIT example, using yue.require("temp") and the provided temp.yue error case. Trace the yue.require entry point to determine why the error is swallowed and why a traceback is printed. Done means pcall receives the failure, the custom xpcall handler can run, and yue.require does not print the traceback automatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.