husonlab / megan-ce

MEGAN Community Edition
GNU General Public License v3.0
66 stars 22 forks source link

Command completetd with Error: null #18

Open Viola-TA opened 1 year ago

Viola-TA commented 1 year ago

Hello all, I am looking for an explanation for my problem with Megan. [Version MEGAN Community Edition (version 6.24.23, built 9 May 2023)] I have run two very similar datasets with Megan. Both were prepared with Diamond for Megan. Both Diamond files (.daa) are the same size (2.7 GB / 3.0 GB) and have the same origin. One sample ran without a problem, the other sample has an error. The error is only displayed at the end of the process. Megan finishes the command but no new window opens to see the graphic.

Annotating DAA file using FAST mode (accession database and first accession per line)
Error: null
null
Info: Finished meganizing 1 files. ERRORS: 1
Info: Command completed (3804s)

Does anyone have any ideas? Many thanks for any tips :)

Greetings, Viola

ssb22 commented 1 year ago

The reason why you're getting null rather than a more descriptive error message is, there are several places in the MEGAN code that catch any Java Exception (and in one place even any Throwable) and call the caught object's getMessage(). Not every Exception in Java implements getMessage(), and the default implementation just returns null. If we're going to catch any Exception then we can't assume its getMessage() will return anything meaningful: if we're going to use it, we at the very least need fallback code that calls toString() instead if getMessage() isn't giving us anything.

On your setup you could try editing just src/megan/commands/MeganizeDAACommand.java and change System.err.println(ex.getMessage()); into System.err.println(""+ex); but I'll put in a pull request to catch more of these.

Note that this change will not solve your original problem, but it might make it easier to diagnose what the problem is because it'll give us a more meaningful message than null.