DynDeveloper.com

DynDeveloper.com

Sign Up Now!Log In
wulala 2/24/2017 1:51:27 AM

eConnect Exception Handling doesn't work in WEB API 2 [FIXED]

Hi, im developing a web api2 application to integrate with GP2015. But my web api 2 couldn't catch any econnect exception error! May i know why?(But it did catch exception error) 

Code as Below:

 

...

                catch (eConnectException exc)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                    {
                        Content = new StringContent(exc.ToString()),
                        ReasonPhrase = "Critical Exception"
                    });
                }

...

Version: GP 2015
Section: .NET Development, Dynamics GP, eConnect