0
这与我的其他职位。我想在一些异常逻辑添加,所以我编码如下:MVC - 抛出异常,但给消息说我必须从列表中返回一个值
public IEnumerable<DrillFormat> List(string partitionKey)
{
try {
_drillServiceContext.MergeOption = MergeOption.NoTracking; // set when you will not be updating this entity
var results = from c in
_drillServiceContext.drillTable
where c.PartitionKey == partitionKey
select c;
var query = results.AsTableServiceQuery();
var queryResults = query.Execute();
return queryResults;
} catch (Exception e) {
System.Diagnostics.Trace.TraceInformation(e.Message
+ Environment.NewLine + e.StackTrace);
throw new Exception("Error while accessing the data store.", e);
}
}
,但现在我得到一个消息说,“并不是所有的代码路径返回一个值”。这是否意味着即使我抛出异常,我也必须返回一个值?