# Error Promise IONIC 2

**URL:** <https://forum.ionicframework.com/t/error-promise-ionic-2/89119>\
**Category:** ionic-v3\
**Created:** [May 5, 2017, 6:29pm UTC](https://forum.ionicframework.com/t/error-promise-ionic-2/89119 "2017-05-05T18:29:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danillo10](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/danillo10/32/108584_2.png) [@danillo10](https://forum.ionicframework.com/u/danillo10)\
**Post date:** [May 5, 2017, 6:29pm UTC](https://forum.ionicframework.com/t/error-promise-ionic-2/89119/1 "2017-05-05T18:29:11Z")

</div>

how to return the "text of error in promise;

```auto
if(data.rows.length > 0){
this.storage.executeSql("UPDATE configDB SET loja = ?, servidor = ?, token = ?, itens = ?, servidores = ?", [config.loja, config.servidor, config.token, config.itens, config.servidores])
.then(
(data) => {
this.presentToast("Configuração atualizada com sucesso.");
},
(error) => {
this.presentToast(error);
});

```

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [May 5, 2017, 6:38pm UTC](https://forum.ionicframework.com/t/error-promise-ionic-2/89119/2 "2017-05-05T18:38:08Z")

</div>

If you’re asking “how do I return the result of an asynchronous operation out of the function that initiated it?”, the short answer is “you can’t”. The longer answer is that the best you can do is return the Promise itself.

---

<div class="post-metadata">

**Author:** ![danillo10](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/danillo10/32/108584_2.png) [@danillo10](https://forum.ionicframework.com/u/danillo10)\
**Post date:** [May 5, 2017, 6:39pm UTC](https://forum.ionicframework.com/t/error-promise-ionic-2/89119/3 "2017-05-05T18:39:33Z")

</div>

> [@danillo10](#):
>
> (error) =\> {  
> this.presentToast(error);  
> });

no, i want read it: “error”  
here:  
(error) =\> {  
this.presentToast(error); error = Object  
});

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [May 5, 2017, 6:41pm UTC](https://forum.ionicframework.com/t/error-promise-ionic-2/89119/4 "2017-05-05T18:41:52Z")

</div>

You can use `JSON.stringify()` to guide you as to what the object looks like, but a safer way would be to look at the public API of whatever function is generating the result.

---

<div class="post-metadata">

**Author:** ![danillo10](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/danillo10/32/108584_2.png) [@danillo10](https://forum.ionicframework.com/u/danillo10)\
**Post date:** [May 5, 2017, 6:51pm UTC](https://forum.ionicframework.com/t/error-promise-ionic-2/89119/5 "2017-05-05T18:51:07Z")

</div>

> [@rapropos](#):
>
> JSON.stringify()

Thanks man, now i can!!
