In the catch statement which is now:
try
{
eval("dataarr="+message.body);
wp.sendMessage("Valid data found, start adding to local db");
}
catch (ex)
{
wp.sendMessage("Error Tosca: No valid data found. Data
was:"+message.body,message.sender);
I thought it looked valid data too.:-(
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Oblygre
> Sent: Thursday, February 19, 2009 2:08 PM
> To: Gears Users
> Subject: [gears-users] Re: serverresponse
>
>
> You data look valid.
> Where is you wp.sendMessage located which shows this message?
> and did you fix this (shown under) as described earlier? If its coming
> from this, I understand, otherwise I don't have a clue.
> **from Feb 18, 8:31 pm ********************
> And here, no error but a wrong feedback to the user:
> eval("dataarr="+serverresponse);
> wp.sendMessage("Error: No valid data found. Data
> was:"+serverresponse,message.sender); //This line is only executed if
> the eval goes ok, so it should return some ok status like "Valid data
> found, start adding to local db"
> **********************
> On Feb 19, 10:21 am, "meerkat" <[email protected]> wrote:
> > Hello,
> > Now getting the message:
> > Error: No valid data found. Data
> >
> was:[{"order_id":"033665136312108","order_no":"10000","order_no_iteration"
> :"
> >
> 1","estimated_completion_date":"1211491800","other_contact_tel":"077100826
> 29
> >
> "},{"order_id":"720448404212108","order_no":"10001","order_no_iteration":"
> 1"
> > ,"estimated_completion_date":"1210894200","other_contact_tel":""},{"orde
> r_id
> >
> ":"469387193612108","order_no":"10002","order_no_iteration":"1","estimated
> _c
> > ompletion_date":"1211491800","other_contact_tel":"07710082629"}
> >
> > What do I need to do to make data valid?
> > Thanks, meerkat.
> >
> >
> >
> > > -----Original Message-----
> > > From: [email protected] [mailto:gears-
> [email protected]]
> > > On Behalf Of Oblygre
> > > Sent: Thursday, February 19, 2009 6:45 AM
> > > To: Gears Users
> > > Subject: [gears-users] Re: serverresponse
> >
> > > You can remove the if(1) construct, it dosen't do anything....
> >
> > > try change
> > > wp.sendMessage("Error in workerPool: "+errorObject.message+" on
> > > line"+errorObject.lineNumber,message.sender); And get " message is
> > > not
> > > defined"
> > > to
> > > wp.sendMessage("Error in workerPool",message.sender);
> >
> > > Im my last response I asked to you remove the serverresponse and
> > > replace with message.body
> > > Try that
> >
> > > On Feb 18, 10:58 pm, "meerkat" <[email protected]> wrote:
> > > > Tried wp.sendMessage("Error in workerPool:
> "+errorObject.message+" on
> > > > line"+errorObject.lineNumber,message.sender); And get " message is
> not
> > > > defined"
> > > > Still get "serverresponse is not defined" in-
> > > > catch (ex)
> > > > {
> > > > wp.sendMessage("Error: No valid data found. Data
> > > > was:"+serverresponse,message.sender);
> >
> > > > return;
> > > > }
> > > > Thanks.
> >
> > > > What is if(1) testing by the way?
> >
> > > > > -----Original Message-----
> > > > > From: [email protected] [mailto:gears-
> > > [email protected]]
> > > > > On Behalf Of Oblygre
> > > > > Sent: Wednesday, February 18, 2009 9:19 PM
> > > > > To: Gears Users
> > > > > Subject: [gears-users] Re: serverresponse
> >
> > > > > Replace your
> > > > > alert("Error in workerPool: "+errorObject.message+" on
> > > > > line"+errorObject.lineNumber);
> > > > > with
> > > > > wp.sendMessage("Error in workerPool: "+errorObject.message+" on
> > > > > line"+errorObject.lineNumber,message.sender);
> >
> > > > > The next I don't understand, but we can try
> > > > > commenting out
> > > > > // var serverresponse= message.body;
> > > > > and
> > > > > try change
> > > > > eval("dataarr="+serverresponse);
> > > > > to
> > > > > eval("dataarr="+message.body);
> >
> > > > > Another thing:
> > > > > The
> > > > > if (1)
> > > > > {
> > > > > construct can be removed...
> >
> > > > > Br
> >
> > > > > Olav
> > > > > On Feb 18, 9:43 pm, "meerkat" <[email protected]> wrote:
> > > > > > Thanks Olav for taking the time to help me.
> > > > > > I now have 2 errors in databaseworker.js:
> > > > > > "alert is not defined" at-
> > > > > > wp.onerror = function(errorObject)
> > > > > > {
> > > > > > alert("Error in workerPool: "+errorObject.message+" on
> > > > > > line"+errorObject.lineNumber);
> > > > > > };
> >
> > > > > > And: "serverresponse is not defined" at -
> > > > > > catch (ex)
> > > > > > {
> > > > > > wp.sendMessage("Error: No valid data found. Data
> > > > > > was:"+serverresponse,message.sender);
> >
> > > > > > return;
> > > > > > }
> >
> > > > > > What should I change?
> > > > > > meerkat
> >
> > > > > > > -----Original Message-----
> > > > > > > From: [email protected] [mailto:gears-
> > > > > [email protected]]
> > > > > > > On Behalf Of Oblygre
> > > > > > > Sent: Wednesday, February 18, 2009 7:32 PM
> > > > > > > To: Gears Users
> > > > > > > Subject: [gears-users] Re: serverresponse
> >
> > > > > > > A quick answer:
> > > > > > > In databaseworker.js:
> > > > > > > What is ex.message? I think your error is here:
> > > > > > > line: wp.sendMessage(ex.message,message.sender);
> > > > > > > Try replace this line with
> > > > > > > wp.sendMessage("Error: No valid data found. Data
> > > > > > > was:"+serverresponse,message.sender);
> >
> > > > > > > And here, no error but a wrong feedback to the user:
> > > > > > > eval("dataarr="+serverresponse);
> > > > > > > wp.sendMessage("Error: No valid data found. Data
> > > > > > > was:"+serverresponse,message.sender); //This line is only
> > > executed if
> > > > > > > the eval goes ok, so it should return some ok status like
> "Valid
> > > data
> > > > > > > found, start adding to local db"
> >
> > > > > > > Try and report back...
> >
> > > > > > > Sorry for my late reply, I been very busy lately...
> >
> > > > > > > Olav
> >
> > > > > > > On Feb 18, 2:23 pm, "meerkat" <[email protected]> wrote:
> > > > > > > > Have you had a chance to look at the serverresponse code
yet?
> I
> > > am
> > > > > still
> > > > > > > > stuck :-(
> > > > > > > > Thanks.
> >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: [email protected] [mailto:gears-
> > > > > > > [email protected]]
> > > > > > > > > On Behalf Of meerkat
> > > > > > > > > Sent: Tuesday, February 17, 2009 10:14 AM
> > > > > > > > > To: [email protected]
> > > > > > > > > Subject: [gears-users] Re: workerpool messages
> >
> > > > > > > > > And here is the code from the php page that creates the
> json:
> >
> > > > > > > > > while($obj = mysql_fetch_object($rs))
> > > > > > > > > {
> > > > > > > > > $arr[] = $obj;
> >
> > > > > > > > > }
> > > > > > > > > $serverresponse = json_encode($arr);
> > > > > > > > > echo $serverresponse;
> >
> > > > > > > > > ( I am having to use php4)
> >
> > > > > > > > > Thanks
> >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: [email protected] [mailto:gears-
> > > > > > > [email protected]]
> > > > > > > > > > On Behalf Of Oblygre
> > > > > > > > > > Sent: Tuesday, February 17, 2009 8:12 AM
> > > > > > > > > > To: Gears Users
> > > > > > > > > > Subject: [gears-users] Re: workerpool messages
> >
> > > > > > > > > > Please post the relevant code so its easier for us to
> help
> > > you
> > > > > > > > > > :--))))))))))
> > > > > > > > > > Olav
> >
> > > > > > > > > > On Feb 16, 12:36 pm, "meerkat" <[email protected]> wrote:
> > > > > > > > > > > Hi,
> > > > > > > > > > > In my main Gears file I have "alert(data);" and the
> > > correct
> > > > > data
> > > > > > > is
> > > > > > > > > > there. I
> > > > > > > > > > > get the message "Status: "36117 byte(s) read from main
> DB,
> > > > > adding
> > > > > > > data
> > > > > > > > > > to
> > > > > > > > > > > local DB".
> >
> > > > > > > > > > > Where do I set " var serverresponse=message.body;" If
> I
> > > put it
> > > > > in
> > > > > > > > > > > databaseworker.js I get "message is not defined"
error.
> > > > > > > > > > > Thanks, meerkat
> >
> > > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > > From: [email protected] [mailto:gears-
> > > > > > > > > > [email protected]]
> > > > > > > > > > > > On Behalf Of Oblygre
> > > > > > > > > > > > Sent: Monday, February 16, 2009 6:03 AM
> > > > > > > > > > > > To: Gears Users
> > > > > > > > > > > > Subject: [gears-users] Re: workerpool messages
> >
> > > > > > > > > > > > You get the error beacuse data in your
> serverresponse
> > > > > variable
> > > > > > > > > > > > contains not valid json data.
> > > > > > > > > > > > Try
> > > > > > > > > > > > wp.sendMessage("Error: No valid data found. Data
> > > > > > > > > > > > was:"+serverresponse,message.sender);
> > > > > > > > > > > > to have a look at the data your getting.
> > > > > > > > > > > > Serverresponse varaiable must be set to the recived
> data
> > > > > from
> > > > > > > the
> > > > > > > > > > > > parent script.
> > > > > > > > > > > > In my example over, serverresponse must be set to
> > > > > message.body
> > > > > > > > > > > > var serverresponse=message.body;
> >
> > > > > > > > > > > > On Feb 15, 8:01 pm, "meerkat" <[email protected]>
> wrote:
> > > > > > > > > > > > > OK, now getting wp messages on screen.
> > > > > > > > > > > > > In main html file I am getting "undefined" for
> > > > > > > > > > > > "workerPool.sendMessage(data,
> > > > > > > > > > > > > childWorkerId)".
> >
> > > > > > > > > > > > > I have done, for testing purposes, alert(data);
> and
> >
> > > > > > > > > > > alert(childWorkerId);
> >
> > > > > > > > > > > > > and they are returning the correct values
> > individually.
> > > So
> > > > > why
> > > > > > > is
> > > > > > > > > > > > > "console.log(workerPool.sendMessage(data,
> > > > > childWorkerId));"
> > > > > > > > > getting
> > > > > > > > > > > > > "undefined"?
> >
> > > > > > > > > > > > > In databaseworker.js I now have:
> > > > > > > > > > > > > "
> > > > > > > > > > > > > try
> > > > > > > > > > > > > {
> > > > > > > > > > > > > eval("dataarr="+serverresponse);
> >
> > > > > > > > > > > > > }
> > > > > > > > > > > > > catch (ex)
> > > > > > > > > > > > > {
> > > > > > > > > > > > > wp.sendMessage("Error: No valid data
> > > > > > > > > > found..",message.sender);
> > > > > > > > > > > > > return;
> > > > > > > > > > > > > }"
> >
> > > > > > > > > > > > > And I am getting "Error: No valid data found.."
> > > message.
> >
> > > > > > > > > > > > > Any more suggestions?
> > > > > > > > > > > > > meerkat
> >
> > > > > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > > > > From: [email protected]
> [mailto:gears-
> > > > > > > > > > > > [email protected]]
> > > > > > > > > > > > > > On Behalf Of Oblygre
> > > > > > > > > > > > > > Sent: Sunday, February 15, 2009 2:52 PM
> > > > > > > > > > > > > > To: Gears Users
> > > > > > > > > > > > > > Subject: [gears-users] Re: workerpool messages
> >
> > > > > > > > > > > > > > A suggestion how to return and show messages
> from a
> > > > > > > workerpool.
> > > > > > > > > > > > > > Also a replay to your other message :-))
> >
> > > > > > > > > > > > > > In your databaseworker.js:
> > > > > > > > > > > > > > var wp = google.gears.workerPool;
> > > > > > > > > > > > > > wp.onmessage = function(a, b, message) {
> > > > > > > > > > > > > > wp.sendMessage("Ok,
> started....",message.sender);
> > > > > //Send
> > > > > > > > > message
> > > > > > > > > > bak
> > > > > > > > > > > > > > to caller
> > > > > > > > > > > > > > .. other code
> >
> > > > > > > > > > > > > > In your calling script:
> > > > > > > > > > > > > > workerPool =
> > > > > google.gears.factory.create('beta.workerpool');
> > > > > > > > > > > > > > workerPool.onmessage = function(a, b,
> message) {
> > > > > > > > > > > > > >
> >
> > ...
> >
> > read more »