Skip to content

fix: do not panic when encountering unkown enum values in gsx integration#10831

Open
Saschl wants to merge 3 commits into
flybywiresim:masterfrom
Saschl:fix/gsx-enum-panic
Open

fix: do not panic when encountering unkown enum values in gsx integration#10831
Saschl wants to merge 3 commits into
flybywiresim:masterfrom
Saschl:fix/gsx-enum-panic

Conversation

@Saschl

@Saschl Saschl commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #[issue_no]

Summary of Changes

For some LVARs, GSX seems to set an unkown value when using the "Complete Now" functionality. Instead of panicking and crashing the whole wasm gauge, we now log a warning and return a fallback value.

Also adds a custom hook for panics to print the error message. The default behaviour does not print the backtrace anymore, which makes troubleshooting harder as we get not much information in the logs besides the info that the gauge crashed.

Screenshots (if necessary)

New log when the wasm panics

image

References

Additional context

Discord username (if different from GitHub):

Testing instructions

GSX needed:

  1. Enable GSX sync in the EFB and load a flight plan or enter some values on the weight/balance page.
  2. Start boarding with GSX
  3. A few moments after, complete the boarding early via the GSX menu (clicking on the "boarding" tile again -> Complete now)
  4. Make sure the plane still works (powers up, flaps lever and parking brake lever work)

How to download the PR for QA

Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo or flybywire-aircraft-a380-842 download link at the bottom of the page

@github-project-automation github-project-automation Bot moved this to 🟡 Code Review: Ready for Review in Quality Assurance Jul 12, 2026
@github-actions github-actions Bot added the MSFS2024 Issues & PRs for MSFS2024 label Jul 12, 2026
// The default panic output is lost when the WASM instance aborts, so print the
// panic message and location to the MSFS console before the trap happens.
std::panic::set_hook(Box::new(|panic_info| {
println!("A32NX_SYSTEMS PANIC: {panic_info}");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also like to print to stderr but the formatting in the console is off then as it prints multiple lines. Like this the offending line is printed in the same log line which makes search easier

@Saschl Saschl changed the title fix: do not panic when encountering unkown enum values in gsx sync fix: do not panic when encountering unkown enum values in gsx integration Jul 12, 2026
@beheh

beheh commented Jul 14, 2026

Copy link
Copy Markdown
Member

How about we change to the TryFrom trait here instead? That forces the consumer to deal with this (because then the conversion can Err), rather than hiding behind a panic in the enum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MSFS2024 Issues & PRs for MSFS2024

Projects

Status: 🟡 Code Review: Ready for Review

Development

Successfully merging this pull request may close these issues.

2 participants