Exception handling in Web API

后端 未结 3 1116
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 08:54

In my Web API project, I created sub projects (class libraries) where I handle actual data handling operations. My backend database is DocumentDB.

My question is how

3条回答
  •  离开以前
    2021-01-12 09:11

    If you want to intercept and log the error in your console application but still forward the error to the caller, just use throw; at the end of your catch statement in your console application.

    It will rethrow the same exception to the caller, so your application can be aware of the exception in the "callee" as well as in the "caller".

提交回复
热议问题