Skip to content

Commit

Permalink
Fixes elastic#40714: Import API don't override SavedObjectClient erro…
Browse files Browse the repository at this point in the history
…rs (elastic#41125) (elastic#42753)

* Import API: Don't override SavedObjectClient errors

* Review comments: rely on default hapi error behaviour
  • Loading branch information
rudolf committed Aug 6, 2019
1 parent d0ff5f4 commit 4399d41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Expand Up @@ -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',
Expand All @@ -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 }));
});
}
});
}
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import Boom from 'boom';
import Joi from 'joi';
import { importDashboards } from '../../../lib/import/import_dashboards';

Expand All @@ -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);
}
});
}

0 comments on commit 4399d41

Please sign in to comment.