Mobrovac has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/395974 )
Change subject: Update restbase to 316f10d ...................................................................... Update restbase to 316f10d List of changes: dc2b3fa Require hyperwsitch v0.9.6 47c0374 Add CORS headers to error responses as well 9ce7018 Add CORS if an error happened while adding CORS dd500bc Rethrow error instead of returning it 1ca2ca1 Wrap possible Error in HTTPError to provide it headers as well 316f10d Use HTTPError.fromError to wrap an unexpended exception xxxxxxx Update node module dependencies Change-Id: I64293fd25ee74e6ba78631e936ceea28022a69b4 --- M node_modules/content-type/package.json M node_modules/hyperswitch/lib/exports.js M node_modules/hyperswitch/lib/server.js M node_modules/hyperswitch/package.json M node_modules/json-stable-stringify/package.json M node_modules/kad/package.json M node_modules/restbase-mod-table-cassandra-ng/package.json M node_modules/restbase-mod-table-spec-ng/package.json M node_modules/swagger-ui/package.json M restbase 10 files changed, 50 insertions(+), 37 deletions(-) Approvals: Mobrovac: Verified; Looks good to me, approved diff --git a/node_modules/content-type/package.json b/node_modules/content-type/package.json index 2c73deb..93b8043 100644 --- a/node_modules/content-type/package.json +++ b/node_modules/content-type/package.json @@ -49,7 +49,7 @@ "/" ], "_resolved": "git+https://github.com/wikimedia/content-type.git#47b2632d0a2ee79a7d67268e2f6621becd95d05b", - "_shasum": "bc530ae7742a43bc2b90ecb0b95130ebf8d29b62", + "_shasum": "0cec1c1dc706ce90b01846c214e63cf9c2f71b86", "_shrinkwrap": null, "_spec": "content-type@git+https://github.com/wikimedia/content-type.git#master", "_where": "/opt/service", diff --git a/node_modules/hyperswitch/lib/exports.js b/node_modules/hyperswitch/lib/exports.js index 8e28a47..a757d65 100644 --- a/node_modules/hyperswitch/lib/exports.js +++ b/node_modules/hyperswitch/lib/exports.js @@ -57,6 +57,32 @@ } Object.assign(this, response); } + + /** + * Factory function wrapping generic JS Error to HTTPError + * @param {Error} e original error + * @return {HTTPError} + */ + static fromError(e) { + if (e && e.name === 'HTTPError') { + return e; + } + const originalError = e; + const stack = e && e.stack; + e = new HTTPError({ + status: 500, + body: { + type: 'internal_error', + description: `${e}` + // Probably better to keep this private for now + // stack: e.stack + } + }); + // Log this internally + e.stack = stack; + e.innerError = originalError; + return e; + } } exporting.HTTPError = HTTPError; diff --git a/node_modules/hyperswitch/lib/server.js b/node_modules/hyperswitch/lib/server.js index 13da8d5..3f34042 100644 --- a/node_modules/hyperswitch/lib/server.js +++ b/node_modules/hyperswitch/lib/server.js @@ -367,20 +367,7 @@ }) .catch((e) => { if (!e || e.name !== 'HTTPError') { - const originalError = e; - const stack = e && e.stack; - e = new exporting.HTTPError({ - status: 500, - body: { - type: 'internal_error', - description: `${e}` - // Probably better to keep this private for now - // stack: e.stack - } - }); - // Log this internally - e.stack = stack; - e.innerError = originalError; + e = exporting.HTTPError.fromError(e); } if (!e.status) { e.status = 500; diff --git a/node_modules/hyperswitch/package.json b/node_modules/hyperswitch/package.json index e2fdfc9..ebc43a8 100644 --- a/node_modules/hyperswitch/package.json +++ b/node_modules/hyperswitch/package.json @@ -2,25 +2,25 @@ "_args": [ [ { - "raw": "hyperswitch@^0.9.1", + "raw": "hyperswitch@^0.9.6", "scope": null, "escapedName": "hyperswitch", "name": "hyperswitch", - "rawSpec": "^0.9.1", - "spec": ">=0.9.1 <0.10.0", + "rawSpec": "^0.9.6", + "spec": ">=0.9.6 <0.10.0", "type": "range" }, "/opt/service" ] ], - "_from": "hyperswitch@>=0.9.1 <0.10.0", - "_id": "hyperswitch@0.9.5", + "_from": "hyperswitch@>=0.9.6 <0.10.0", + "_id": "hyperswitch@0.9.6", "_inCache": true, "_location": "/hyperswitch", "_nodeVersion": "6.11.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", - "tmp": "tmp/hyperswitch-0.9.5.tgz_1511783692861_0.05067970836535096" + "tmp": "tmp/hyperswitch-0.9.6.tgz_1512599665470_0.6939467759802938" }, "_npmUser": { "name": "doorman", @@ -31,21 +31,21 @@ "jsonify": "0.0.0" }, "_requested": { - "raw": "hyperswitch@^0.9.1", + "raw": "hyperswitch@^0.9.6", "scope": null, "escapedName": "hyperswitch", "name": "hyperswitch", - "rawSpec": "^0.9.1", - "spec": ">=0.9.1 <0.10.0", + "rawSpec": "^0.9.6", + "spec": ">=0.9.6 <0.10.0", "type": "range" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/hyperswitch/-/hyperswitch-0.9.5.tgz", - "_shasum": "69ad64720f9b0c6cd69ee80133985a81a835f11e", + "_resolved": "https://registry.npmjs.org/hyperswitch/-/hyperswitch-0.9.6.tgz", + "_shasum": "48d2e35971af45f4168fdfe450a4818fa98e8cd2", "_shrinkwrap": null, - "_spec": "hyperswitch@^0.9.1", + "_spec": "hyperswitch@^0.9.6", "_where": "/opt/service", "author": { "name": "Wikimedia Service Team", @@ -84,10 +84,10 @@ }, "directories": {}, "dist": { - "shasum": "69ad64720f9b0c6cd69ee80133985a81a835f11e", - "tarball": "https://registry.npmjs.org/hyperswitch/-/hyperswitch-0.9.5.tgz" + "shasum": "48d2e35971af45f4168fdfe450a4818fa98e8cd2", + "tarball": "https://registry.npmjs.org/hyperswitch/-/hyperswitch-0.9.6.tgz" }, - "gitHead": "55894b3db425992fa349b09b531c990d996f420c", + "gitHead": "80d98c19ca8706894ae6e2197efbda75056f0625", "homepage": "https://github.com/wikimedia/hyperswitch", "keywords": [ "REST", @@ -126,5 +126,5 @@ "coveralls": "cat ./coverage/lcov.info | coveralls", "test": "mocha" }, - "version": "0.9.5" + "version": "0.9.6" } diff --git a/node_modules/json-stable-stringify/package.json b/node_modules/json-stable-stringify/package.json index 9ee81ba..3e3b5ce 100644 --- a/node_modules/json-stable-stringify/package.json +++ b/node_modules/json-stable-stringify/package.json @@ -51,7 +51,7 @@ "/restbase-mod-table-cassandra-ng" ], "_resolved": "git+https://github.com/wikimedia/json-stable-stringify.git#c05178e4dfc3834017f017732934c1c52ba3dd8f", - "_shasum": "8b533632991cade45418caae1cf7ca5663d50916", + "_shasum": "655287d4401be08ba8f108f76e00f72a30a106ce", "_shrinkwrap": null, "_spec": "json-stable-stringify@git+https://github.com/wikimedia/json-stable-stringify.git#master", "_where": "/opt/service", diff --git a/node_modules/kad/package.json b/node_modules/kad/package.json index 91b17f8..21aacd1 100644 --- a/node_modules/kad/package.json +++ b/node_modules/kad/package.json @@ -49,7 +49,7 @@ "/limitation" ], "_resolved": "git+https://github.com/gwicke/kad.git#936c91652d757ea6f9dd30e44698afb0daaa1d17", - "_shasum": "730448b50b13ed895f55127045cf1f7c9e735a6a", + "_shasum": "522e5f74411260189f3e98aabfa3d9734ccd3575", "_shrinkwrap": null, "_spec": "kad@git+https://github.com/gwicke/kad.git#master", "_where": "/opt/service/node_modules/limitation", diff --git a/node_modules/restbase-mod-table-cassandra-ng/package.json b/node_modules/restbase-mod-table-cassandra-ng/package.json index 01122fb..35cc792 100644 --- a/node_modules/restbase-mod-table-cassandra-ng/package.json +++ b/node_modules/restbase-mod-table-cassandra-ng/package.json @@ -49,7 +49,7 @@ "/" ], "_resolved": "git+https://github.com/wikimedia/restbase-mod-table-cassandra.git#b3492319daecfb269c5b2082ee1b5df1c0deb7b6", - "_shasum": "9df3d864c0ac15570a533993d92825d8f3007f1d", + "_shasum": "704f080f9bd31ab835782ff3642d48e8ccd2f732", "_shrinkwrap": null, "_spec": "restbase-mod-table-cassandra-ng@git+https://github.com/wikimedia/restbase-mod-table-cassandra.git#redesign", "_where": "/opt/service", diff --git a/node_modules/restbase-mod-table-spec-ng/package.json b/node_modules/restbase-mod-table-spec-ng/package.json index 36458fc..e1f2b6f 100644 --- a/node_modules/restbase-mod-table-spec-ng/package.json +++ b/node_modules/restbase-mod-table-spec-ng/package.json @@ -49,7 +49,7 @@ "/restbase-mod-table-cassandra-ng" ], "_resolved": "git+https://github.com/wikimedia/restbase-mod-table-spec.git#aa0a252e8de67dda822923236d2b54b9b945ae90", - "_shasum": "79c5f314cfdb1b88d4e15c6b813a46fdd36c1153", + "_shasum": "891da5f91e3891b4a7420ebc706a838631ca47d7", "_shrinkwrap": null, "_spec": "restbase-mod-table-spec-ng@git+https://github.com/wikimedia/restbase-mod-table-spec.git#redesign", "_where": "/opt/service/node_modules/restbase-mod-table-cassandra-ng", diff --git a/node_modules/swagger-ui/package.json b/node_modules/swagger-ui/package.json index 43911cb..a7c6540 100644 --- a/node_modules/swagger-ui/package.json +++ b/node_modules/swagger-ui/package.json @@ -49,7 +49,7 @@ "/hyperswitch" ], "_resolved": "git+https://github.com/wikimedia/swagger-ui.git#b9b40dc8e00caeb24c19fe636b93250a7e335541", - "_shasum": "9befeafb00990e20bdf85e3030cdfe1b78fd51c7", + "_shasum": "8067a062619de2af1d63f48c9e9bdc651ab81c5f", "_shrinkwrap": null, "_spec": "swagger-ui@git+https://github.com/wikimedia/swagger-ui.git#master", "_where": "/opt/service/node_modules/hyperswitch", diff --git a/restbase b/restbase index 1a71389..316f10d 160000 --- a/restbase +++ b/restbase @@ -1 +1 @@ -Subproject commit 1a71389f1e798ec046fe63aa0145a777b70f1773 +Subproject commit 316f10dc4daf075e3222b0d3d8587e76ed5bacb9 -- To view, visit https://gerrit.wikimedia.org/r/395974 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I64293fd25ee74e6ba78631e936ceea28022a69b4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/restbase/deploy Gerrit-Branch: master Gerrit-Owner: Mobrovac <mobro...@wikimedia.org> Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org> Gerrit-Reviewer: Ppchelko <ppche...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits