I found that to handle error while parsing json through TJSONParser is necessary to consider two types of exceptions:

EJSONScanner from jsonparser
EScannerError from jsonscanner

This has the drawback of need to duplicate code like:

   on E: EJSONScanner do
    begin
      ShowMessageFmt('Error parsing "%s" : %s', [FileName, E.Message]);
    end;
    on E: EScannerError do
    begin
      ShowMessageFmt('Error parsing "%s" : %s', [FileName, E.Message]);
    end;

Also requires to add jsonscanner to uses clause

Is it supposed to be this way?
Is there any benefit?
Should a bug report be made?

Luiz


_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to