Comparing version 0.5.26 to 0.5.27
@@ -145,2 +145,7 @@ /** | ||
return result; | ||
}, function(errData) { | ||
if (errData.meta) { | ||
self.options._serviceMeta.push(errData.meta); | ||
} | ||
throw errData; | ||
}); | ||
@@ -147,0 +152,0 @@ |
@@ -209,3 +209,3 @@ /** | ||
this.req = this.options.req || {}; | ||
this.serviceMeta = []; | ||
this._serviceMeta = []; | ||
@@ -339,3 +339,10 @@ } | ||
var errResponse = getErrorResponse(err); | ||
res.status(errResponse.statusCode).json(responseFormatter(req, res, errResponse.output)); | ||
if (req.query && req.query.returnMeta) { | ||
res.status(errResponse.statusCode).json(responseFormatter(req, res, { | ||
output: errResponse.output, | ||
meta: meta | ||
})); | ||
} else { | ||
res.status(errResponse.statusCode).json(responseFormatter(req, res, errResponse.output)); | ||
} | ||
return; | ||
@@ -423,3 +430,3 @@ } | ||
req: this.req, | ||
serviceMeta: this.serviceMeta | ||
serviceMeta: this._serviceMeta | ||
}); | ||
@@ -459,3 +466,3 @@ if (1 === arguments.length) { | ||
req: this.req, | ||
serviceMeta: this.serviceMeta | ||
serviceMeta: this._serviceMeta | ||
}); | ||
@@ -496,3 +503,3 @@ if (1 === arguments.length) { | ||
req: this.req, | ||
serviceMeta: this.serviceMeta | ||
serviceMeta: this._serviceMeta | ||
}); | ||
@@ -532,3 +539,3 @@ if (1 === arguments.length) { | ||
req: this.req, | ||
serviceMeta: this.serviceMeta | ||
serviceMeta: this._serviceMeta | ||
}); | ||
@@ -572,3 +579,3 @@ if (1 === arguments.length) { | ||
Fetcher.prototype.getServiceMeta = function () { | ||
return this.serviceMeta; | ||
return this._serviceMeta; | ||
}; | ||
@@ -575,0 +582,0 @@ |
@@ -196,2 +196,6 @@ /** | ||
err.body = errBody || body; | ||
if (err.body) { | ||
err.output = err.body.output; | ||
err.meta = err.body.meta; | ||
} | ||
if (408 === status || 0 === status) { | ||
@@ -198,0 +202,0 @@ err.timeout = options.timeout; |
{ | ||
"name": "fetchr", | ||
"version": "0.5.26", | ||
"version": "0.5.27", | ||
"description": "Fetchr augments Flux applications by allowing Flux stores to be used on server and client to fetch data", | ||
@@ -43,2 +43,3 @@ "main": "index.js", | ||
"request": "^2.61.0", | ||
"sinon": "^1.17.3", | ||
"supertest": "^1.0.1" | ||
@@ -45,0 +46,0 @@ }, |
@@ -235,2 +235,15 @@ # Fetchr | ||
And in your service call: | ||
```js | ||
fetcher | ||
.read('someData') | ||
.params({id: ###}) | ||
.end(function (err, data, meta) { | ||
if (err) { | ||
// err.output will be { message: "Not found", more: "meta data" } | ||
} | ||
}); | ||
``` | ||
## XHR Timeouts | ||
@@ -237,0 +250,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65969
1285
432
13