fetch() 오류 처리
fetch() 약속은 HTTP 오류로 인해 거부되지 않습니다. https://developer.mozilla.org/en-US/docs/Web/API/fetch fetch(api url) .then(( response ) => { if(!response.ok) { throw new Error(`error status: ${response.status}`) } return response.json() }) .then(( data ) => { // 처리 코드 console.log(data) }) .catch((error) => { // 에러 처리 코드 console.log(error) })