且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在异步Azure函数HTTP触发的函数中捕获Azure表的异常引发

更新时间:2023-02-14 21:27:37

我猜想,使用 IAsyncCollector<> 会破坏这里的内容.如果要避免此类问题,请尝试交换以下绑定:

I guess, that using IAsyncCollector<> breaks things here. If you want to avoid such problems, try to exchange the following binding:

[Table("Debug")] IAsyncCollector<Entry> tableBinding

收件人:

[Table("Debug")] CloudTable tableBinding

然后,使用以下代码段代替使用 tableBinding.AddAsync():

Then, instead of using tableBinding.AddAsync() use the following snippet:

var op = TableOperation.Insert(new Entry());
await tableBinding.ExecuteAsync(op);

使用这种方法,您应该能够捕获异常,而不会将其泄漏到Function运行时.

With that approach, you should be able to catch the exception, without leaking it to the Functions runtime.