Joseph King
Joseph King

Reputation: 5219

BreezeJS failure callback causing a 'undefined is not an object error' exception

The following breeze query works perfectly fine

var manager = emFactory.newManager();
return manager.executeQuery(query).then(querySucceeded);

but when i add the failure callback and re-run the application

var manager = emFactory.newManager();
return manager.executeQuery(query).then(querySucceeded).fail(function (err) {});

an 'undefined is not an object error' exception it thrown.

I've been scratching my head on this one for a while so any help would be much appreciated.

Upvotes: 0

Views: 610

Answers (1)

Raphael Müller
Raphael Müller

Reputation: 2200

Oh I got it.

It's not fail it's catch.

use it like this:

return manager.executeQuery(q).then(success).catch(failed);

edit: with

function success(response) {}

and

function failed(error) {}

Upvotes: 3

Related Questions