Skip to content

Commit

Permalink
plantuml error message
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Feb 9, 2023
1 parent 180f8aa commit 2939f92
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions OneMore/Commands/Images/DrawPlantUmlCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ internal class DrawPlantUmlCommand : Command
private const string PlantMeta = "omPlant";
private const string ImageMeta = "omPlantImage";

private string errorMessage;


public DrawPlantUmlCommand()
{
Expand Down Expand Up @@ -85,6 +87,12 @@ public override async Task Execute(params object[] args)

var bytes = ConvertToDiagram(text);

if (!string.IsNullOrWhiteSpace(errorMessage))
{
UIHelper.ShowError(errorMessage);
return;
}

// get settings...

var after = true;
Expand Down Expand Up @@ -161,7 +169,7 @@ public override async Task Execute(params object[] args)

private byte[] ConvertToDiagram(string text)
{
using var progress = new ProgressDialog(10);
using var progress = new ProgressDialog(15);
progress.Tag = text;
progress.SetMessage("Converting using the service http://www.plantuml.com...");

Expand All @@ -179,9 +187,9 @@ private byte[] ConvertToDiagram(string text)
}
catch (Exception exc)
{
errorMessage = exc.Message;
logger.WriteLine(text);
logger.WriteLine("error rendering plantuml", exc);
UIHelper.ShowError(Resx.DrawPlantUml_Error);
return false;
}

Expand Down

0 comments on commit 2939f92

Please sign in to comment.