octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternati


From: anonymous
Subject: [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json
Date: Sat, 7 Nov 2020 08:17:54 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0

Follow-up Comment #39, patch #9980 (project octave):

[comment #38 comment #38:]
> Sorry, I didn't read the changeset earlier. But this snippet might give
misleading error messages:
> 
> It might be better to remove the try-catch-block and let regexprep display
an error message directly.

You are correct that the cause of the error could be misleading and it
bothered me too.  But I'm not sure that resorting to 'regexprep' error is a
better solutions.   

The problem I wanted to avoid is if 'fromJSON' was buried in another
script/function, an error from 'regexprep' (rather than 'fromJSON') would be
confusing or misleading too.  I know it is always possible to trace the
problem to 'fromJSON' but not easily for novices.

Initially I tried to post-process the error from 'regexprep', but I could not
replicate the error and verify that the solution was adequate.  As such, I opt
with this.

While I too am unsure about what else might cause 'regexprep' error, since
'str' is already screen for classtype, unless 'regexprep' changes methods, I
think it could be safe to say that a runtime error would only be from 'str'
content.  Maybe not UTF-8 specifically but content nonetheless.

At best, it might be "safer" to just return a generic, 'Invalid JSON string'
and drop the reference to UTF-8.  But I'm on the fence as to whether that is
any better.

Or if someone share with me a sample file or method to replicate the problem,
I can fix this better. 

I await suggsetions....

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9980>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]