Skip to content

Log the exception when BEAUti fails to switch a model - #125

Merged
walterxie merged 1 commit into
masterfrom
fix/log-beauti-selection-errors
Jul 26, 2026
Merged

Log the exception when BEAUti fails to switch a model#125
walterxie merged 1 commit into
masterfrom
fix/log-beauti-selection-errors

Conversation

@alexeid

@alexeid alexeid commented Jul 24, 2026

Copy link
Copy Markdown
Member

When selecting a value in a model dropdown fails, the combo handler in BEASTObjectInputEditor.addComboBox shows a dialog:

Could not select beastObject: <class> <message>

but never logs the exception, so there is no stack trace to diagnose from. This is the situation in BEAST2-Dev/bModelTest#9: switching the substitution model to HKY while "BEAST Model Test" is the site model pops a dialog with nothing in the console. With the stack trace restored, the real cause is visible:

java.lang.RuntimeException: Cannot find template for removing RevJump.s:dna
    at beastfx.app.inputeditor.BeautiSubTemplate.removeSubNet(BeautiSubTemplate.java:308)
    at beastfx.app.inputeditor.BeautiSubTemplate.createSubNet(BeautiSubTemplate.java:315)
    at beastfx.app.inputeditor.BEASTObjectInputEditor.lambda$addComboBox$0(BEASTObjectInputEditor.java:238)

This PR just adds ex.printStackTrace() before the dialog, so selection failures are diagnosable. (The Cannot find template for removing failure itself is a separate matter — removeSubNet throws when no BeautiSubTemplate matches the model being replaced.)

When selecting a value in a model dropdown fails, the combo handler in
BEASTObjectInputEditor showed a dialog ("Could not select beastObject: ...")
but never logged the exception, so there was no stack trace to work from --
exactly the situation in BEAST2-Dev/bModelTest#9, where switching the
substitution model to HKY while BEAST Model Test was active produced a
dialog and nothing in the console. The underlying error was
'Cannot find template for removing RevJump.s:dna' from
BeautiSubTemplate.removeSubNet, invisible until now.

Print the stack trace before showing the dialog.
@alexeid
alexeid requested a review from walterxie July 24, 2026 07:44
@walterxie
walterxie merged commit 4491b15 into master Jul 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants