Exception.number in 2003 OM = ? in 2007 OM - InfoPath Dev
in

InfoPath Dev

Exception.number in 2003 OM = ? in 2007 OM

Last post 07-19-2011 12:30 AM by michaelr524. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-13-2011 06:35 AM

    Exception.number in 2003 OM = ? in 2007 OM

    Hi, I'm porting forms from 2003 JS API to 2007 C# OM in order to prepare for migration to SP2010. There is some code where the form is submitted, it's wrapped in try-catch and when an exception is caught it's e.number is used for showing the appropriate message to the user. My question is what is the parallel of Exception.number in C# 2007 OM? Thanks, Michael
  • 07-17-2011 02:21 AM In reply to

    Re: Exception.number in 2003 OM = ? in 2007 OM

    Anyone has any idea? Thanks, Michael
  • 07-17-2011 11:31 AM In reply to

    Re: Exception.number in 2003 OM = ? in 2007 OM

    It depends on the type of exception thrown. The base Exception class does not expose an exception code.  There is an HResult, but it is not a public member. 

    A exception type of COMException has an ErrorCode, which contains the standard COM errors.  You should check the type of error being thrown and see if it has a an ErrorCode or equivalent field.  Exceptions also contain an InnerException property, which if set may provide the additional detail needed. 

    try
    {
     // something
    }
    catch (COMException ce)
    {
      if (ce.ErrorCode == 0x800A03EC)
      {
      // try something else
      }
    }

  • 07-19-2011 12:30 AM In reply to

    Re: Exception.number in 2003 OM = ? in 2007 OM

    Hi Jim, Thank's for your answer. The exception I get receive is WebException, no ErrorCode property there. I'm actually starting to believe I should use HResult, maybe by getting it through reflection... I've checked the value of HResult in a debugger and the number is close to the number which is handled in the code I'm porting, but it is not identical so I'm not sure it's the right place to look.. Do you have more ideas? Thanks, Michael
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.