mercredi 20 avril 2016

Ember errors not populated in model with RESTAdapter in Ember 2.4.5 and Ember DATA 2.4.0

I'm trying to handle server errors in an Ember application.

I'm running the following code in ember app:

customization.save().catch(function (error) {
      console.log(error);
      console.log(customization.get('errors'));
      console.log(customization.get('errors.length'));
    });

And my server is answering the following json:

{  
   "errors":[  
      {  
         "code":"app.customization.validationError.duplicateCustomizationName",
         "detail":"a customization with same name already exists",
         "source":{  
            "pointer":"customization/name"
         }
      }
   ]
}

The error is an InvalidError, but customization.get('errors.length') is always 0.

I'm using a DS.RESTAdapter along with DS.RESTSerializer in Ember 2.4.5 with Ember DATA 2.4.0.

What am I missing ?

Thanks




Aucun commentaire:

Enregistrer un commentaire