shldhee / note

개인노트
0 stars 0 forks source link

try, catch error 처리 #2

Open shldhee opened 3 years ago

shldhee commented 3 years ago
try {
.../
 } catch (err) {
      if (!err.response || err.response.status !== 404) {
        return error({
          statusCode: 500,
          message: 'An error occurred'
        })
      }

      return error({
        statusCode: 404,
        message: 'Page not found'
      })
    }
shldhee commented 3 years ago