Throwing an exception not only unwinds the test but also signals an error.
抛出异常不仅要展开测试,还将报告错误。
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
The first mistake that nonnative speakers make is to return a value indicating an error, instead of throwing an exception.
非原生语言使用者的第一类错误是返回一个表示错误的值,而不是抛出异常。
If I do this, try and get the 10th element of a list that's only eight long. I get what looks like an error, but it's actually throwing an exception.
如果我来这么做,试着去取长度为8的列表的第十个元素,我貌似能得到一个错误。
应用推荐