[fpc-devel] fpjson/jsonparser: EJSONScanner vs EScannerError

Luiz Americo Pereira Camara luizmed at oi.com.br
Sun May 29 17:12:42 CEST 2011


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





More information about the fpc-devel mailing list