MCPcopy Create free account
hub / github.com/jishi/node-sonos-http-api / transformError

Function transformError

static/docs/lib/swagger.js:1510–1527  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

1508
1509 // Transform an error into a usable response-like object
1510 var transformError = function (error) {
1511 var out = {
1512 // Default to a status of 0 - The client will treat this as a generic permissions sort of error
1513 status: 0,
1514 data: error.message || error
1515 };
1516
1517 if (error.code) {
1518 out.obj = error;
1519
1520 if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
1521 // We can tell the client that this should be treated as a missing resource and not as a permissions thing
1522 out.status = 404;
1523 }
1524 }
1525
1526 return out;
1527 };
1528
1529 var res = {
1530 error: function (response) {

Callers 1

swagger.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected