JSON parser improvement - to deal with utf exceptions
We use the Jade Rest service (& Json parser) as part of an interface to receive messages from our Customers, from a web page. The front end and all touch-points before the rest service are 3rd party software.
We get many Exceptions UE1416 (unicode to ansi conversion failed) or UE1418 (illegal byte sequence in utf8 chars). These exceptions cause a lot of 'noise' and inconvenience, so it would great to be able to handle these exceptions, either by a native handler, or by allowing us to add methods to the WebMessage (hidden) class.
Or allow a 'clean' of the incoming before parsing.
HistoricalComments
Software Medical Infomatics Limited 30/01/2018 1:08:52 PM Hear hear. I've encountered these too and it would be great to handle them better.
|
Hi,
We already have some capability in the product to catch these exceptions. Specifically, you could raise a global exception handler in the initialization method of the webapp, e.g.
handleException(_exception: Exception): Integer;
begin
if _exception.errorCode = 1418 or _exception.errorCode = 1416 then
return Ex_Abort_Action;
else
return Ex_Pass_Back;
endif;
end;
This would allow you to catch the exception before it's logged and eliminate noise in the log files. However, you would not have access to the webmessage.
Is this sufficient to handle the issue you are describing? If not could you please provide a more detailed description of exactly what sort of information you would like to have access to in the case of an exception like this being raised - and what sort of action you would like to be able to take.
Comments from any of the voters on this JEDI would be welcome too.
Thanks!