Skip to content

Commit

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

* Import API: Don't override SavedObjectClient errors

* Review comments: rely on default hapi error behaviour
  • Loading branch information
rudolf authored Aug 6, 2019
1 parent 5192dac commit f7568e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
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 }));
});
}
});
}
Original file line number Diff line number Diff line change
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 f7568e6

Please sign in to comment.