Then .then method takes two arguments a callback, and errback. Right now
you are not handling the error condition, so Im not sure that an error isnt
being thrown. try adding a second method to the .then that handles an error.
.then(function(object){
if(object){
util.log('OBJECT : ' + object['macAddress']);
} else {
util.log('This message doesn\'t exist for ' + macAddress + '
> device');
> response.writeHeader(404, {
'Content-Type': 'text/xml'
});
response.end('<status><code>404</code><description>Message not
> found</description></status>');
}
}, function(error){
console.error(error);
> });
On Thursday, March 29, 2012 9:29:42 AM UTC-5, FluxB0x wrote:
>
> I need your help and it's urgent please !!
>
> I want to retrieve one record. Into phpMyAdmin this request run perfectly,
> but when i'm using your module with these lines don't work ... How can i
> retrieve the record that i want ? Thanks
>
>>
>
> var Device = db.from('Device');
>
> util.log(db.from('Device').sql);
>
> var DevicePushIDStateMessage = Device.join('PushID', {idDevice:
>> sql.macAddress}).join('State', {pushId: sql.deviceToken});
>
> util.log(Device.join('PushID', {idDevice:
>> sql.macAddress}).join('State', {pushId: sql.deviceToken}).sql);
>
> util.log(DevicePushIDStateMessage.filter({macAddress: macAddress,
>> messageId: idMessage}).sql);
>
>
>> DevicePushIDStateMessage.first({macAddress: macAddress, messageId:
>> idMessage}).then(function(object){
>
> if(object){
>
> util.log('OBJECT : ' + object['macAddress']);
>
> } else {
>
> util.log('This message doesn\'t exist for ' + macAddress + '
>> device');
>
>
>> response.writeHeader(404, {
>
> 'Content-Type': 'text/xml'
>
> });
>
> response.end('<status><code>404</code><description>Message not
>> found</description></status>');
>
> }
>
> });
>
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en