Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should have a better error message when [unit]type= in ActionWML names an unknown type #8847

Open
stevecotton opened this issue May 4, 2024 · 1 comment
Labels
Enhancement Issues that are requests for new features or changes to existing ones. WML Issues involving the WML engine or WML APIs.

Comments

@stevecotton
Copy link
Contributor

Describe the desired feature

In 1.18.0+dev 545ba26, trying to create a [unit] with an unknown type from ActionWML gives an uninformative error message, to both stdout and the in-game chat:

<Lua caught unknown exception>

In 1.16 it still gave a Lua error, but named the unit type (to both stdout and the in-game chat):

error scripting/lua: game_error: unknown unit type: AE_mag_Mystical_Toadxxxxxx
stack traceback:
	[C]: in local 'cmd'
	lua/wml-utils.lua:144: in field 'handle_event_commands'
	lua/wml-flow.lua:5: in function <lua/wml-flow.lua:4>

The information is available to 1.18, because the exception is thrown from src/units/unit.cpp:223:

if(!i) throw unit_type::error("unknown unit type: " + type_id);

but it ends up here at src/scripting/lua_common.cpp:1171:

ERR_LUA << "Lua caught unknown exception";
@stevecotton stevecotton added Enhancement Issues that are requests for new features or changes to existing ones. WML Issues involving the WML engine or WML APIs. labels May 4, 2024
@soliton-
Copy link
Member

Sounds like it might be related to #8234.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Issues that are requests for new features or changes to existing ones. WML Issues involving the WML engine or WML APIs.
Projects
None yet
Development

No branches or pull requests

2 participants