Cannot read property 'id' of undefined

Hello guys.

I’m in the learning process of the whole Ember framework and I ran into some challenges, so to say. I’m getting this error, where I am trying to retrieve a user that DO NOT exist on purpose ofcouse:

Error while processing route: user Cannot read property ‘id’ of undefined TypeError: Cannot read property ‘id’ of undefined

Instead of this console error, can I give the user an error message saying, ‘the user does not exist’ or something like that through the route or a controller to the view?

Heres my route

App.Router.map(function () {
	this.resource('user', { path: '/user/:user_id' });
});

And here i retrieve the user

App.UserRoute = Ember.Route.extend({
	model: function(params) {
		return this.store.find('user', params.user_id);
	},
});

Hope you understand and can help me proceed. Thanks in regards!

What does the json look like you returned? I’m guessing you’re returning a 200 with an error object that doesn’t have an id which I think causes this problem try returning a 404.