Skip to content

Commit

Permalink
- fixed exception on empty script
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoBL committed Jan 21, 2022
1 parent 75501ad commit b98b69d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
19 changes: 12 additions & 7 deletions Rosi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,21 @@ static async Task<int> Main(string[] args)
}


var runtime = new Runtime.Runtime(null, args);
try
{
var runtime = new Runtime.Runtime(null, args);

Console.OutputEncoding = Encoding.UTF8;
Console.Title = runtime.Config.Get("rosi.title", "Rosi");
var result = await runtime.RunAsync();
Console.OutputEncoding = Encoding.UTF8;
Console.Title = runtime.Config.Get("rosi.title", "Rosi");
var result = await runtime.RunAsync();

if (runtime.Config.Get("rosi.waitforexit", false))
Console.ReadKey();
if (runtime.Config.Get("rosi.waitforexit", false))
Console.ReadKey();
return result;
}
catch { }

return result;
return -1;
}
}
}
10 changes: 6 additions & 4 deletions Runtime/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ public Runtime(Type debugMainType = null, params string[] args)
}
else
{
Log.Fatal(Tr.Get("Runtime.NoArgs"), this);
return;
var error = Tr.Get("Runtime.NoArgs");
Log.Fatal(error, this);
throw new ArgumentException(error, nameof(args));
}
}
else
Expand All @@ -95,8 +96,9 @@ public Runtime(Type debugMainType = null, params string[] args)
}
else
{
Log.Fatal(Tr.Get("Runtime.MainScriptMissing", args[0]), this);
return;
var error = Tr.Get("Runtime.MainScriptMissing", args[0]);
Log.Fatal(error, this);
throw new FileNotFoundException(error);
}
}
}
Expand Down

0 comments on commit b98b69d

Please sign in to comment.