From d717b761c979f71b1a2765540d5ab2bf3efd5432 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Fri, 10 Jan 2020 15:45:41 +0000 Subject: [PATCH] Remove redundant try-catch --- src/routes/add-article.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/routes/add-article.ts b/src/routes/add-article.ts index 84470e90..24b3672c 100644 --- a/src/routes/add-article.ts +++ b/src/routes/add-article.ts @@ -7,7 +7,6 @@ import { termToString } from 'rdf-string'; import uniqueString from 'unique-string'; import url from 'url'; import { AppContext, AppMiddleware } from '../app'; -import NotAnArticle from '../errors/not-an-article'; import { rdf, schema } from '../namespaces'; import Routes from './index'; @@ -44,15 +43,7 @@ export default (): AppMiddleware => ( request.dataset.delete(originalQuad).add(newQuad); }); - try { - await articles.set(newId, request.dataset); - } catch (error) { - if (error instanceof NotAnArticle) { - throw new createHttpError.BadRequest(error.message); - } - - throw error; - } + await articles.set(newId, request.dataset); response.status = constants.HTTP_STATUS_CREATED; response.set('Location', url.resolve(request.origin, router.url(Routes.ArticleList)));