8.5 服务器统一出错处理2

一、errorVSpanic

  1. 意料之中的:使用error(想得到的错误)。如文件打不开

  2. 意料之外的:使用panic。如数组越界

  3. 意料之外的使用panic也要进行保护

Last updated

Was this helpful?