Fixes #40714: Import API don't override SavedObjectClient errors (#41125)

* Import API: Don't override SavedObjectClient errors

* Review comments: rely on default hapi error behaviour
This commit is contained in:
Rudolf Meijering 2019-08-06 19:49:07 +02:00 committed by GitHub
parent 5192dac0b6
commit f7568e6fbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -17,10 +17,11 @@
* under the License.
*/
import { exportDashboards } from '../../../lib/export/export_dashboards';
import Boom from 'boom';
import Joi from 'joi';
import moment from 'moment';
import { exportDashboards } from '../../../lib/export/export_dashboards';
export function exportApi(server) {
server.route({
path: '/api/kibana/dashboards/export',
@ -46,8 +47,7 @@ export function exportApi(server) {
.header('Content-Disposition', `attachment; filename="${filename}"`)
.header('Content-Type', 'application/json')
.header('Content-Length', Buffer.byteLength(json, 'utf8'));
})
.catch(err => Boom.boomify(err, { statusCode: 400 }));
});
}
});
}

View file

@ -17,7 +17,6 @@
* under the License.
*/
import Boom from 'boom';
import Joi from 'joi';
import { importDashboards } from '../../../lib/import/import_dashboards';
@ -40,11 +39,7 @@ export function importApi(server) {
},
handler: async (req) => {
try {
return await importDashboards(req);
} catch (err) {
throw Boom.boomify(err, { statusCode: 400 });
}
return await importDashboards(req);
}
});
}