add error message to track occurences of #448

This commit is contained in:
Basile Burg 2019-02-11 05:23:30 +01:00
parent adb1449863
commit 1cb19aadd0
1 changed files with 10 additions and 2 deletions

View File

@ -1737,11 +1737,14 @@ end;
{$REGION Miscellaneous DUB free functions --------------------------------------} {$REGION Miscellaneous DUB free functions --------------------------------------}
function sdl2json(const filename: string): TJSONObject; function sdl2json(const filename: string): TJSONObject;
const
fmt = 'unexpected failure of SDL to JSON convertion'#10'CurrentDirectory = %s'#10'dub process working dir = %s';
var var
dub: TProcess; dub: TProcess;
str: TStringList; str: TStringList;
jsn: TJSONData; jsn: TJSONData = nil;
prs: TJSONParser; prs: TJSONParser;
t: string;
begin begin
result := nil; result := nil;
dub := TProcess.Create(nil); dub := TProcess.Create(nil);
@ -1758,7 +1761,12 @@ begin
dub.Execute; dub.Execute;
processOutputToStrings(dub, str); processOutputToStrings(dub, str);
while dub.Running do; while dub.Running do;
prs := TJSONParser.Create(str.Text, [joIgnoreTrailingComma, joUTF8]); t := str.Text;
if t.isEmpty then
begin
raise Exception.Create(format(fmt, [GetCurrentDir, dub.CurrentDirectory]));
end;
prs := TJSONParser.Create(t, [joIgnoreTrailingComma, joUTF8]);
try try
try try
jsn := prs.Parse; jsn := prs.Parse;