Page 1 of 1

Generic service: adding settings.error

Posted: Tue Feb 25, 2014 7:16 pm
by Dennis Wormsbecher

Hello,

I'm trying to build a generic inlog service. Which uses the default DB_login_service if you are online but offline I want to check the SQLite db.
The problem is that in the example I have used: "http://docs.appery.io/tutorials/build...".
The DB_login_service returns an error and that is used to display a message.
I would like to do the same with my generic service (and any other service I'm going to build). But I cannot find any document/example/tutorial of how to generate/raise an error and how to fill that error with some information?


Generic service: adding settings.error

Posted: Tue Feb 25, 2014 7:52 pm
by Kateryna Grynko

Hi Dennis,

Could you post the error screenshot please?


Generic service: adding settings.error

Posted: Tue Feb 25, 2014 7:58 pm
by Dennis Wormsbecher

Nevermind,

I just worked it out, with the help of some information inhere: "https://getsatisfaction.com/apperyio/..."
in the topis there's mention of:
this.settings.error(jqXHR, textStatus, errorThrown);
this.settings.complete('error');

And that's just what I needed.
my solotion (it's this simple):
settings.error({ "code": 999, "error": "wrong user or password"});
settings.complete('error');

But this could have been a lot easier if this is mentioned with the Generic Service documentation.

In the documentation the succes way is mentioned many times:
settings.success(JSON.parse(cdata));
settings.complete('success');

But alas no reference to other forms of results (and how to implement).

These things are frustrating, but all in all I've made huge steps with Appery and am finding the builder a pleasant one to work with.


Generic service: adding settings.error

Posted: Tue Feb 25, 2014 8:08 pm
by Kateryna Grynko

Dennis,

Thank you for the feedback!