If you can, use a try-catch block.
如果能,那么使用try - catch块。
The code should ideally be wrapped by try-catch blocks.
最好把代码放在try - catch块中。
If you need more complex behavior, you can add try-catch-finally blocks.
如果需要更复杂的行为,那么也可以添加try - catch -finally块。
If the content isn't supported, the code throws an exception, which is caught by the try-catch block.
如果内容不受支持,那么代码抛出一个异常,此异常由try - catch块捕捉到。
Because the category property can either be multivalued or single-valued, you check for it with a try-catch statement.
因为分类属性可以是多值的也可以是单值的,所以要用try - catch语句检查它。
However, you'll still need to use the old try-catch style if you want to test the exception's detail message or other properties.
但是如果您想要测试异常的详细消息或其他属性,则仍然需要使用旧式的try - catch样式。
These contain information about all the try-catch blocks in the method, so you'll have to correlate the throw and catch information to identify the bug pattern.
它们包含关于方法中所有try - catch块的信息,所以您必须将抛出信息和捕获信息关联,以标识bug模式。
To detect this bug pattern, you'll need to know where the try-catch blocks are, what might be thrown out of the try block, and what is caught in the catch blocks.
要检测此bug模式,则需要知道try - catch块的位置、try块可能抛出的内容以及在catch块中将捕获的内容。
While on the subject, it's worth noting that although the examples in this series use try-catch() blocks to trap and handle exceptions, this isn't strictly necessary.
关于这个问题,有一点值得注意:尽管本系列中的示例使用 try-catch() 代码块来捕捉和处理异常,但这并不是必须的。
From the SOAP client perspective, it's a good idea to wrap the SOAP call inside a try-catch block, so that SOAP faults like the one above can be caught and handled gracefully.
对于SOAP客户端来说,将这个SOAP调用封装在一个try - catch代码块中是很好的做法,这样类似于上面的SOAP错误就会被顺利地捕捉和处理。
When invoking unknown code (which listeners certainly qualify as), it is prudent to execute it in a try-catch block so that ill-behaved listeners do not do more damage than necessary.
在调用未知代码(侦听器就是这样的代码)时,谨慎的方式是在try - catch块中执行它,这样,行为有误的侦听器不会造成更多不必要的破坏。
Each CodeException contains the starting and ending bytecode offset for the corresponding try block, so you can easily determine which CodeException objects correspond to a try-catch block.
每个CodeException都包含相应try块的起始和终止的字节码偏移量,这样您可以方便地确定哪一个CodeException对象与try - catch块对应。
No matter how hard I try I cannot seem to catch up on all the bills.
不管我怎么努力,我好像总也无法付清所有的账单。
"If there are nine rabbits, focus on catching one, don't try to catch them all," he said.
他说:“如果有九只兔子,集中精力抓一只,不要试图把它们全部抓住。”
He stood still stupidly while the boys ran round him, mimicking and laughing; they shouted to him to try and catch them; but he did not move.
他呆呆地站在那儿不动,孩子们围着他跑,一边模仿一边大笑;他们向他喊叫,想让他尝试抓住他们;但他没有动。
When the bear puts his tail into the water through a hole in the ice, to try and catch a fish, the ice freezes around it, and he ends up pulling his tail off.
当熊把尾巴放到了湖面上的冰洞里面去钓鱼的时候,水在熊尾巴周围结冰了。熊使劲儿往外拔它的尾巴,结果把尾巴拔掉了。
哦,现在就试着追上我吧。
Try to catch the elusive charm of the original in translation.
翻译时设法把握住原文中难以捉摸的风韵。
What about certain "I just know we'll need this" type stuff (i.e. putting a try/catch{Console.WriteLine(ex);} in your console main() method?)
对于象“我心里清楚我们需要这个”这类东西——我们该如何处理(例如,在控制台main()方法中加上一个try/catch{Console.WriteLine(ex);}?)
They will try to catch you out, so have all your answers well prepared.
他们想挑你的毛病,所以你要把所有的回答都准备好。
Everybody will try to catch you. You have no friend.
所有人都试图抓住你,你没有任何朋友。
But there is a catch: Try running the code below, and it works for some of the cells.
但有一个问题:尝试运行下面的代码,它对某些单元格有效。
Don't try and catch a falling knife.
不要试图抓住一把下落的刀。
Each fisherman will try to catch as many fish as possible in order to maximize his profits.
为了最大化自身收益,每个渔夫都会尝试捕捞尽可能多的鱼。
Pelicans try to catch fish with their beaks during lunch time at the Hellabrunn zoo in Munich, Germany.
德国慕尼黑海拉·布伦动物园。鹈鹕在午餐时间用长长的喙捕鱼。
Don't fret over lost time; don't try to catch up with yesterday's unfinished tasks.
不要为逝去的时间而懊悔;不要以为可以弥补昨天未完成的任务。
Try to "catch 'em being good".
尽量去“逮到”他们做好事。
And don't try to catch a bus here from Khiva. Get a shared taxi.
随身携带美元现金,不要去搭乘从这里到希瓦的巴士,可以和别人合租出租车。
And don't try to catch a bus here from Khiva. Get a shared taxi.
随身携带美元现金,不要去搭乘从这里到希瓦的巴士,可以和别人合租出租车。
应用推荐