07th-mod / 07th-mod/higurashi-assembly
"Unhandled Operation" Error during script compile is only logged but not thrown otherwise signalled
- Dominant language
- C#
- Stars
- 12
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
I was testing hou+ using the standalone compiler, and noticed two errors were output while compiling `&opening.txt`.
```c#
void OpeningLaunch()
{
if (GetGlobalFlag(GVideoOpening) >= 3) {
PlayOriginMovie();
}
}
void OpeningStory()
{
if (GetGlobalFlag(GVideoOpening) >= 2) {
SetGlobalFlag(GVideoOpening, 3);
PlayOriginMovie();
}
}
void PlayOriginMovie()
{
if (GetGlobalFlag(GArtStyle) == 2) {
// Play OG video if using OG artstyle
PlayVideo("video/mv13-pc.mp4", 1920, 1080);
} else {
// Otherwise play console art style
PlayVideo("video/mv13-cs.mp4", 1920, 1080);
}
}
```
The error is that `PlayOriginMovie();` should actually be `CallSection("PlayOriginMovie");`
I'm not sure if this works anyway, even without the CallSection, as the movie does seem to play.
But I was wondering how we've been running CI/building the scripts without noticing this error. I then checked where the error was raised:
```C#
public void ParseOperation(ITree tree)
{
name = tree.GetChild(0).Text;
line = tree.Line;
BGIParameters param = (tree.ChildCount <= 1) ? new BGIParameters() : new BGIParameters(tree.GetChild(1));
if (paramLookup.ContainsKey(name))
{
OutputCmd(name, param);
return;
}
Debug.LogError("Unhandled Operation " + name);
CmdOpNull();
}
```
It looks like the error is just printed out, but there is no signalling during compile that an error occurred, so the compiler thinks everything is OK.
----
Will need to check whether this was done deliberately (as the script seems to work anyway under this condition).
But personally, since this only happens if there is a genuine error, I would want to throw an exception and tell the developer to fix the script (since it should usually be an easy fix).
----
Also check if this applies to previous chapters (apply this fix to the `mod` branch)
Contributor guide
No contributing guide indexed for this repository
Research direction
Look at the ParseOperation method in the compiler code where the 'Unhandled Operation' error is logged. The issue is to change Debug.LogError to throw an exception or otherwise signal a compilation failure. Check if this pattern exists in other chapters (mod branch). Verify if the script still works despite the error, as the user notes the movie seems to play.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100