Javascript : fetch 함수에서의 에러처리 (catch, finally 메소드)
담담이담
개요 Promise 객체가 rejected 되었을 때 실행하고 싶은 콜백은 then 메소드의 두 번째 파라미터로 넣는다. 하지만 이 방법 말고 catch 메소드를 사용하는 방법도 존재한다. // Internet Disconnected fetch('') .then((response) => response.text(), (error) => { console.log(error); }) .then((result) => { console.log(result); }); 1. catch 메소드 1) catch 메소드란? catch 메소드는 Promise 객체가 rejected 되었을 때 실행하고 싶은 콜백을 등록하는 메소드이다. // Internet Disconnected fetch('') .then((respons..