정민우

[Edit] dockerfile add 예외처리

...@@ -19,6 +19,7 @@ exports.addDockerfile = async (req, res) => { ...@@ -19,6 +19,7 @@ exports.addDockerfile = async (req, res) => {
19 logging('dockerfile', 'error', { code: 400, message: `missingKey:${required}` }, req) 19 logging('dockerfile', 'error', { code: 400, message: `missingKey:${required}` }, req)
20 return sendError(res, 400, `missingKey:${required}`) 20 return sendError(res, 400, `missingKey:${required}`)
21 } 21 }
22 + try {
22 let dockerfileInfo = {} 23 let dockerfileInfo = {}
23 dockerfileInfo.userId = id 24 dockerfileInfo.userId = id
24 dockerfileInfo.content = req.body.content 25 dockerfileInfo.content = req.body.content
...@@ -34,6 +35,11 @@ exports.addDockerfile = async (req, res) => { ...@@ -34,6 +35,11 @@ exports.addDockerfile = async (req, res) => {
34 let user = await Dockerfile.create(dockerfileInfo) 35 let user = await Dockerfile.create(dockerfileInfo)
35 logging('dockerfile', 'add dockerfile', user, req) 36 logging('dockerfile', 'add dockerfile', user, req)
36 return sendResponse(res, user, 200) 37 return sendResponse(res, user, 200)
38 + } catch (error) {
39 + logging('dockerfile', 'error', { code: 500, message: error.message }, req)
40 + return sendError(res, 500, error.message)
41 + }
42 +
37 } 43 }
38 44
39 exports.listDockerfile = async (req, res) => { 45 exports.listDockerfile = async (req, res) => {
......