Skip to content

Commit 28cfc87

Browse files
committed
[FEAT] Suggested better error management
PLEASE NOTE: All of this have been tested but only with CLI. I don't really know neither can test the GUI but I hope it doesn't rely on bad error management.
1 parent c3a8deb commit 28cfc87

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

EDSSharp/Program.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,46 @@ static void Main(string[] args)
6666

6767

6868
default:
69+
Program.WriteError("Invalid INFILE extension.");
70+
PrintHelpText();
6971
return;
7072

7173
}
7274
if(eds != null)
7375
{
7476
Export(outfile, outtype);
77+
Console.WriteLine("Successful conversion");
78+
}
79+
else
80+
{
81+
Program.WriteError("Invalid XDD INFILE.");
82+
PrintHelpText();
7583
}
7684
}
7785
else
7886
{
87+
Program.WriteError("INFILE or OUTFILE missing.");
7988
PrintHelpText();
8089
}
8190
}
82-
catch(Exception e)
91+
catch(Exception)
8392
{
84-
Console.WriteLine(e.ToString());
93+
Program.WriteError("Invalid EDS INFILE.");
94+
// Console.WriteLine(e.ToString());
8595
PrintHelpText();
8696
}
8797
}
8898

99+
private static void WriteError(string message)
100+
{
101+
Console.ForegroundColor = ConsoleColor.Red;
102+
Console.Error.WriteLine(message);
103+
Console.ResetColor();
104+
Console.WriteLine("");
105+
}
106+
89107
private static void openEDSfile(string infile)
90108
{
91-
92109
eds.Loadfile(infile);
93110
}
94111

0 commit comments

Comments
 (0)