Skip to content

Commit 151c95c

Browse files
committed
Stable Version 1.2.1.
Fixes #9
1 parent 56d216d commit 151c95c

7 files changed

+25
-8
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
##### 1.2.1 - 25 February 2015
2+
3+
###### Backwards compatible bug fixes
4+
- #9 - Does not properly throw error in find() (like other adapters) when the item cannot be found
5+
16
##### 1.2.0 - 24 February 2015
27

38
###### Backwards compatible API changes

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ http adapter for [js-data](http://www.js-data.io/).
1212
| Branch | Master |
1313
| ------ | ------ |
1414
| Bower | [![Bower version](https://badge.fury.io/bo/js-data-http.png)](http://badge.fury.io/bo/js-data-http) |
15-
| NPM | [![NPM version](https://badge.fury.io/js/js-data-http.png)](http://badge.fury.io/js/js-data-http) |
15+
| NPM | [![NPM](https://nodei.co/npm/js-data-http.png?downloads=true&stars=true)](https://nodei.co/npm/js-data-http/) |
1616
| Build Status | [![Circle CI](https://circleci.com/gh/js-data/js-data-http/tree/master.png?style=badge)](https://circleci.com/gh/js-data/js-data-http/tree/master) |
1717
| Code Climate | [![Code Climate](https://codeclimate.com/github/js-data/js-data-http.png)](https://codeclimate.com/github/js-data/js-data-http) |
1818
| Dependency Status | [![Dependency Status](https://gemnasium.com/js-data/js-data-http.png)](https://gemnasium.com/js-data/js-data-http) |

dist/js-data-http.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @author Jason Dobry <[email protected]>
33
* @file js-data-http.js
4-
* @version 1.2.0 - Homepage <http://www.js-data.io/docs/dshttpadapter>
4+
* @version 1.2.1 - Homepage <http://www.js-data.io/docs/dshttpadapter>
55
* @copyright (c) 2014 Jason Dobry
66
* @license MIT <https://github.com/js-data/js-data-http/blob/master/LICENSE>
77
*
@@ -1858,6 +1858,7 @@ if (!JSData) {
18581858
var DSUtils = JSData.DSUtils;
18591859
var deepMixIn = JSData.DSUtils.deepMixIn;
18601860
var http = require('axios');
1861+
var P = DSUtils.Promise;
18611862

18621863
function Defaults() {
18631864

@@ -1997,7 +1998,12 @@ dsHttpAdapterPrototype.find = function (resourceConfig, id, options) {
19971998
_this.getPath('find', resourceConfig, id, options),
19981999
options
19992000
).then(function (data) {
2000-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
2001+
var item = (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
2002+
if (!item) {
2003+
return P.reject(new Error('Not Found!'));
2004+
} else {
2005+
return item;
2006+
}
20012007
});
20022008
};
20032009

dist/js-data-http.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js-data-http.min.map

+1-1
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-http",
33
"description": "http adapter for js-data.",
4-
"version": "1.2.0",
4+
"version": "1.2.1",
55
"homepage": "http://www.js-data.io/docs/dshttpadapter",
66
"repository": {
77
"type": "git",

src/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if (!JSData) {
1919
var DSUtils = JSData.DSUtils;
2020
var deepMixIn = JSData.DSUtils.deepMixIn;
2121
var http = require('axios');
22+
var P = DSUtils.Promise;
2223

2324
function Defaults() {
2425

@@ -158,7 +159,12 @@ dsHttpAdapterPrototype.find = function (resourceConfig, id, options) {
158159
_this.getPath('find', resourceConfig, id, options),
159160
options
160161
).then(function (data) {
161-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
162+
var item = (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
163+
if (!item) {
164+
return P.reject(new Error('Not Found!'));
165+
} else {
166+
return item;
167+
}
162168
});
163169
};
164170

0 commit comments

Comments
 (0)