Fixes for babel-polyfill #17

Merged
joeybaker merged 3 commits from fix-babel-polyfill into master 2016-08-30 05:18:20 +00:00
Showing only changes of commit ce6f1fedde - Show all commits

View File

@ -1,8 +1,4 @@
<<<<<<< b18479e02e3d47da4e40369a8132e07125eb96a3
import Boom from 'boom'; import Boom from 'boom';
=======
import { wrap } from 'boom';
>>>>>>> whatever
export default (target, key, descriptor) => { export default (target, key, descriptor) => {
const fn = descriptor.value; const fn = descriptor.value;
@ -11,7 +7,6 @@ export default (target, key, descriptor) => {
try { try {
await fn(request, reply); await fn(request, reply);
} catch (e) { } catch (e) {
<<<<<<< b18479e02e3d47da4e40369a8132e07125eb96a3
if (e.original) { if (e.original) {
const { code, detail } = e.original; const { code, detail } = e.original;
@ -50,23 +45,6 @@ export default (target, key, descriptor) => {
reply(err); reply(err);
} else { } else {
reply(e); reply(e);
=======
const { code, detail } = e.original;
// pg error codes https://www.postgresql.org/docs/9.5/static/errcodes-appendix.html
if (code && (code.startsWith('22') || code.startsWith('23'))) {
const error = wrap(e, 406);
// detail tends to be more specific information. So, if we have it, use.
if (detail) {
error.message += `: ${detail}`;
error.reformat();
}
reply(error);
} else {
reply(wrap(e));
>>>>>>> whatever
} }
} }
}; };