From 600a79788e0389f7babc02c3490770fe601f01c3 Mon Sep 17 00:00:00 2001 From: taekyoungc Date: Mon, 8 Jun 2026 12:53:02 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=EC=B9=B4=EC=98=A4=20=EC=A7=80?= =?UTF-8?q?=EC=98=A4=EC=BD=94=EB=94=A9=20=ED=98=B8=EC=B6=9C=EC=9D=84=20try?= =?UTF-8?q?/catch=EB=A1=9C=20=EA=B0=90=EC=8B=BC=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 외부(카카오) SDK 예외가 미처리 예외로 전파되어 콘솔 오염· DevTools "예외에서 일시중지"로 화면이 멈추는 것을 방지 - geocodeChain 호출 및 마커 생성 콜백을 방어적으로 보호 Co-Authored-By: Claude Opus 4.8 --- app/Views/bag/_dashboard_kakao_map.php | 48 ++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/app/Views/bag/_dashboard_kakao_map.php b/app/Views/bag/_dashboard_kakao_map.php index 4e29601..cff8360 100644 --- a/app/Views/bag/_dashboard_kakao_map.php +++ b/app/Views/bag/_dashboard_kakao_map.php @@ -115,19 +115,21 @@ $mapId = 'mainKakaoMap'; (function next(i) { if (i >= tries.length) { cb(null); return; } var mode = tries[i][0], q = tries[i][1]; - if (mode === 'addr') { - geocoder.addressSearch(q, function (result, status) { - if (status === kakao.maps.services.Status.OK && result && result[0]) { - cb(new kakao.maps.LatLng(result[0].y, result[0].x)); - } else { next(i + 1); } - }); - } else { - places.keywordSearch(q, function (data, status) { - if (status === kakao.maps.services.Status.OK && data && data[0]) { - cb(new kakao.maps.LatLng(data[0].y, data[0].x)); - } else { next(i + 1); } - }); - } + try { + if (mode === 'addr') { + geocoder.addressSearch(q, function (result, status) { + if (status === kakao.maps.services.Status.OK && result && result[0]) { + cb(new kakao.maps.LatLng(result[0].y, result[0].x)); + } else { next(i + 1); } + }); + } else { + places.keywordSearch(q, function (data, status) { + if (status === kakao.maps.services.Status.OK && data && data[0]) { + cb(new kakao.maps.LatLng(data[0].y, data[0].x)); + } else { next(i + 1); } + }); + } + } catch (e) { cb(null); } })(0); } @@ -165,15 +167,17 @@ $mapId = 'mainKakaoMap'; SHOPS.forEach(function (shop, idx) { geocodeChain(shop, function (pos) { pending--; - if (pos) { - var marker = new kakao.maps.Marker({ position: pos, map: map }); - markers[idx] = marker; - positions[idx] = pos; - bounds.extend(pos); placed++; - kakao.maps.event.addListener(marker, 'click', function () { openInfo(idx); }); - var dot = document.querySelector('.shop-item[data-idx="' + idx + '"] .shop-dot'); - if (dot) { dot.style.background = '#243a5e'; } - } + try { + if (pos) { + var marker = new kakao.maps.Marker({ position: pos, map: map }); + markers[idx] = marker; + positions[idx] = pos; + bounds.extend(pos); placed++; + kakao.maps.event.addListener(marker, 'click', function () { openInfo(idx); }); + var dot = document.querySelector('.shop-item[data-idx="' + idx + '"] .shop-dot'); + if (dot) { dot.style.background = '#243a5e'; } + } + } catch (e) {} if (pending === 0) done(); }); });