Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

app not sendind email

today my app is not sending email through sendgrid, just hangs.

error in console

SyntaxError: JSON.parse: unexpected character
[Break On This Error]

var response = JSON.parse(jqXHR.responseText)

this is the code the error refers to

codevar datasources = [];
sendgrid_mailsend = new Tiggr.DataSource(SendGrid_MailSend, {
'onComplete': function(jqXHR, textStatus) {
var response = JSON.parse(jqXHR.responseText);
if (response.message == 'success') {
alert('Thank You for Your Booking, a text message with your Taxis details will follow shortly..');
} else if (response.message == 'error') {
var error = response.errors[0];
alert('Error sending email.\n' + error + '.');
}; code

I compared with another version, but the code is the same,
can you see the error?
worked perfect yesterday/code/code

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

app not sendind email

Hello! I'll test.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

app not sendind email

There is some problem with service. It returns "java.net.SocketTimeoutException: connect timed out" and JS on Complete service parsing this text as json - that's why you get the error. Replace the code on service Complete with this one:

codetry {
var response = JSON.parse(jqXHR.responseText);

if (response.message == 'success') {
alert ('Email sent.');
}
else if ( response.message == 'error') {
var error = response.errors[0];
alert ('Error sending email.\n'+error+'.');
}
} catch(err) {
console.log("ERROR. name: " + err.name + ", message: " + err.message + ", stack: " + err.stack);
//here you can add some actions to correct the error, or the effects
}/code

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

app not sendind email

/*
Copyright (c) 2012, Exadel Inc. All rights reserved.
version: 1.0b
*/

define(["jQuery","Underscore","MediatorSingletonClass"],function(e,t,a){var n=function(){this.mediator=new a,e.ajaxSetup({cache:!1})};return t.inherit(n,Object,{getItem:function(a){var n=this;
Thanks Marina,
got this error

e.ajax({type:a.methodType"get",url:a.key,dataType:a.dataType"json",crossDomain:a.crossDomain!0,async:a.async!0,data:t.isObject(a.value)&&t.isBoolean(a.stringifyData)&&a.stringifyData?JSON.stringify(a.value):a.value,contentType:a.contentType"application/json",beforeSend:t.isFunction(a.beforeSend)?a.beforeSend:Function(),complete:function(e){if(200==e.status){try{a.value=JSON.parse(e.responseText)}catch(i){a.value=e.responseText}a.xhr=e,t.isFunction(a.callback)&&a.callback(a),n.mediator.Publish("dao:get:item:done",a)}else 404==e.status?(t.extend(a,{value:"error",error_msg:"404 - the resource '"+a.key+"' is not found.",xhr:e}),t.isFunction(a.callback)&&a.callback(a),n.mediator.Publish("dao:get:item:done",a)):(t.extend(a,{value:"error",error_msg:"Something wrong, can't load data from server.",xhr:e}),t.isFunction(a.callback)&&a.callback(a),n.mediator.Publish("dao:get:item:done",a))}})},setItem:function(a){var n=this;e.ajax({type:a.methodType"post",url:a.key,data:t.isObject(a.value)&&t.isBoolean(a.stringifyData)&&a.stringifyData?JSON.stringify(a.value):a.value,dataType:a.dataType"json",contentType:a.contentType"application/json",crossDomain:a.crossDomain!0,async:a.async!0,beforeSend:t.isFunction(a.beforeSend)?a.beforeSend:Function(),complete:function(e){if(200==e.status){try{a.value=JSON.parse(e.responseText)}catch(i){a.value=e.responseText}t.isFunction(a.callback)&&a.callback(a),n.mediator.Publish("dao:set:item:done",a)}else 404==e.status?(t.extend(a,{value:"error",error_msg:"404 - the resource '"+a.key+"' is not found.",xhr:e}),t.isFunction(a.callback)&&a.callback(a),n.mediator.Publish("dao:set:item:done",a)):(t.extend(a,{value:"error",error_msg:"Something wrong, can't load data from server.",xhr:e}),t.isFunction(a.callback)&&a.callback(a),n.mediator.Publish("dao:set:item:done",a))}})}}),n});

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

app not sendind email

Could you clarify where did you get this error?

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

app not sendind email

Hi Marina,
I used the code you suggested, when app opens and I try to navigate to booking screen, and now I'm getting this error, cant understand all was good yesterday

SyntaxError: catch without try
[Break On This Error]

} catch (err) {

jquery-1.8.2.js (line 746, col 14)

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

app not sendind email

Where did you put the code I suggested above? Looks like you missed codetry {/code line

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

app not sendind email

Thanks Marina,
back to sending mail,
but I dont understand what and why the app changed from yesterday and alteration to code was needed?

but thanks again, i was getting worried

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

app not sendind email

Looks like some problem with SendGrid service...

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

app not sendind email

Cheers for that info,
I was going mad here trying to figure out what I had done

Return to “Issues”