Skip to content

Commit

Permalink
Include specific message for each decompilation error reason
Browse files Browse the repository at this point in the history
  • Loading branch information
KronicDeth committed Aug 7, 2017
1 parent d7ff2a0 commit b64a713
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/org/elixir_lang/beam/Decompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;
import java.util.SortedSet;

import static org.elixir_lang.beam.chunk.Chunk.TypeID.ATOM;
import static org.elixir_lang.psi.call.name.Function.DEF;
import static org.elixir_lang.psi.call.name.Function.DEFMACRO;
import static org.elixir_lang.psi.call.name.Module.ELIXIR_PREFIX;
Expand All @@ -36,7 +37,7 @@ public class Decompiler implements BinaryFileDecompiler {

@NotNull
private static CharSequence decompiled(@Nullable Beam beam) {
StringBuilder decompiled = new StringBuilder("Decompilation Error");
StringBuilder decompiled = new StringBuilder("# Decompilation Error: ");

if (beam != null) {
Atoms atoms = beam.atoms();
Expand All @@ -57,8 +58,14 @@ private static CharSequence decompiled(@Nullable Beam beam) {
appendExports(decompiled, beam, atoms);

decompiled.append("end\n");
} else {
decompiled.append("No module name found in ").append(ATOM).append(" chunk in BEAM");
}
} else {
decompiled.append("No ").append(ATOM).append(" chunk found in BEAM");
}
} else {
decompiled.append("BEAM format could not be read");
}

return decompiled;
Expand Down

0 comments on commit b64a713

Please sign in to comment.