@@ -1796,41 +1796,37 @@ async function temizKodMakalesiniAl() {
1796
1796
** [ ⬆ en başa dön] ( #içindekiler ) **
1797
1797
1798
1798
1799
- ## ** Error Handling**
1800
- Thrown errors are a good thing! They mean the runtime has successfully
1801
- identified when something in your program has gone wrong and it's letting
1802
- you know by stopping function execution on the current stack, killing the
1803
- process (in Node), and notifying you in the console with a stack trace.
1804
-
1805
- ### Don't ignore caught errors
1806
- Doing nothing with a caught error doesn't give you the ability to ever fix
1807
- or react to said error. Logging the error to the console (` console.log ` )
1808
- isn't much better as often times it can get lost in a sea of things printed
1809
- to the console. If you wrap any bit of code in a ` try/catch ` it means you
1810
- think an error may occur there and therefore you should have a plan,
1811
- or create a code path, for when it occurs.
1799
+ ## ** Hata Yakalama**
1800
+ Hatalar oluşturmak iyi bir şeydir. Hatalar size programınızda bir şeylerin yolunda olmadığını söylemenin en iyi yoludur.
1801
+ Çalışan bir kod parçacığı ya da çalışmayı durduran bir fonksiyonun, process'in neden durduğuna dair konsol ekranında sizi bilgilendirirler.
1802
+
1803
+ ### Yakalanan Hataları Görmezden Gelmeyin
1804
+ Yakalanan bir hata ile hiçbir şey gerçekleştirmemek, size o hatayı tamamen fixlemiş olma imkanı sunmaz.
1805
+ Hataları (` console.log ` ) ile göstermek, tıpkı suya yazı yazmak gibidir. Çoğu zaman yetersizdir.
1806
+ Eğer kod bölümlerini ` try/catch ` blokları ile oluşturuyorsanız o bölümde bir hatanın oluşabileceğini düşünüyorsunuzdur.
1807
+ Bu durumlar için bir planınız olmalı ya da bu durumları yönetebileceğiniz ayrı kod yapılarınız olmalı.
1812
1808
1813
1809
** Kötü:**
1814
1810
``` javascript
1815
1811
try {
1816
- functionThatMightThrow ();
1817
- } catch (error ) {
1818
- console .log (error );
1812
+ hataFirlatabilecekFonksiyon ();
1813
+ } catch (hata ) {
1814
+ console .log (hata );
1819
1815
}
1820
1816
```
1821
1817
1822
1818
** İyi:**
1823
1819
``` javascript
1824
1820
try {
1825
- functionThatMightThrow ();
1826
- } catch (error ) {
1827
- // One option (more noisy than console.log):
1828
- console .error (error );
1829
- // Another option :
1830
- notifyUserOfError (error );
1831
- // Another option :
1832
- reportErrorToService (error );
1833
- // OR do all three !
1821
+ hataFirlatabilecekFonksiyon ();
1822
+ } catch (hata ) {
1823
+ // İlk seçenek ( console.log'dan daha çok bilgilendirici ):
1824
+ console .error (hata );
1825
+ // Diğer Seçenek :
1826
+ kullaniciyaHataGoster (hata );
1827
+ // Diğer Seçenek :
1828
+ hatayiServiseBildir (hata );
1829
+ // Ya da üçünü de yapabilirsiniz! !
1834
1830
}
1835
1831
```
1836
1832
0 commit comments