Trying to load some json file into a dataset, and came across this message
**Error parsing JSON: expected brace, but found brace. (15358)
Now, call me stupid, but if you expect something and find that something then there should be no error
Unless you were expecting a closing brace and found an opening one or vice versa. Of course, it would be a lot clearer if it said that.
and is that a missing square open brace, or a closing squiggly brace ?
C'mon - let's find the most useless error message.
On 2 August 2011 18:18, Thomas Mercer-Hursh
This error message is coming out of a third-party library we use. Development will log a bug report to investigate generating a more helpful message.
**Error parsing JSON: expected brace, but found brace. (15358)
Brilliant!
Ok, looks like I've got another candidate.
given this code
catch e as Progress.Lang.ProError :
message e:NumMessages skip
view-as alert-box.
end catch.
how could it ever possibly display "0" ?
I mean, if there is an error, the count must be > 0 , right ?
So, if there is an error, how do I find out what it is ?
That's fine! Not every error has messages attached...
UNDO, THROW NEW AppError ("forgive me for not being a message").
Causes an error with NO message.
UNDO, THROW NEW AppError ("forgive me for being a message", 0).
Causes an error with ONE message.
answering my own question.
undo, throw new AppError(substitute("Cannot find template [&1]",lv_fullTemplate)).
this causes the "problem". I should check either the return-value or change the code to read
undo, throw new AppError(substitute("Cannot find template [&1]",lv_fullTemplate),0).
damn, sir, you are fast
So, if there is an error, how do I find out what it is ?
By the other propertiesof the error. Might even ones at you added. Or the type (TYPE-OF).
Welcome to OO error handling
mikefe wrote:
That's fine! Not every error has messages attached...
UNDO, THROW NEW AppError ("forgive me for not being a message").
Causes an error with NO message.
UNDO, THROW NEW AppError ("forgive me for being a message", 0).
Causes an error with ONE message.
We all walk into this trap sooner or later. The syntax with only one parameter does not do what you expect it to do.
Why is that in the first place?
Why is that in the first place?
Because nobody paid attention to specs during the 10.1C beta program ...
I tried to get that fixed in the 10.2A beta program, but then 10.1C was already released (for a few days) and than they wouldn't want to change rolled out behavior.
I guess that happens when nobody is paying attention to a beta, because there is a more recent beta program running in parallel.
But the result is much, much more than dangerous.
That's why I like to have my own Exception (extending AppError) which does not support multiple messages but linking exceptions using the 'cause' exception. I see no point in having more 'messages' for the same exception, I do however throw different kind of exceptions (I do miss the 'throws' option in methods) and if the cause was another exception that will be set as cause of the exception thrown.
Well I can say for myself that I did quite a bit of testing on structured error handling during the 10.1C beta program but I completely missed this bugger (and me and all of my team members have been bitten by it several times since).
I do similar
But rather then "Cause" I use InnerException. I know, I am .NET spoiled.
(and me and all of my team members have been bitten by it several times since).
Everybody get's struck by that every now and then. And error with error-handling are really critical.
I think it's simply poorly designed: The presence of the optional second parameter (the severity - who users that anyway?) should not change the meaning of the first parameter of the same type (CHARACTER).
I guess it was meant for good reasons, so that
RETURN ERROR "ADM-ERROR" .
could simply be replaced with
UNDO, THROW NEW AppError ("ADM-ERROR") .
But the consequences are heavy. I would have suggested an additional startup parameter, to fix this. But as this is soooo critical, I wouldn't want this do depend on a startup parameter.