On Sun, 29 May 2011, Luiz Americo Pereira Camara wrote:

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?

Well, there are 2 different kinds of errors: scanner errors, and parser errors.
They should have 2 different classes.

Should a bug report be made?

You can submit a request so they are merged (or one made a descendent of the 
other).


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

Reply via email to