函數錯誤
(金慶的專欄 2017.10)
摘自:Go語言圣經
https://shower.im/doc/gopl-zh/ch5/ch5-04.html
* 保證成功,沒有錯誤。
* 無法保證成功,如IO操作。
+ 返回bool, 原因只有一個
+ 返回error
5種錯誤處理策略
1. 傳播錯誤
2. 重試
3. 結束程序(只應在main中)
4. 日志
5. 忽略
(金慶的專欄 2017.10)
摘自:Go語言圣經
https://shower.im/doc/gopl-zh/ch5/ch5-04.html
* 保證成功,沒有錯誤。
* 無法保證成功,如IO操作。
+ 返回bool, 原因只有一個
+ 返回error
5種錯誤處理策略
1. 傳播錯誤
2. 重試
3. 結束程序(只應在main中)
4. 日志
5. 忽略