Changeset 18

Show
Ignore:
Timestamp:
06/22/04 00:16:44
Author:
DenisG
Message:

[SubversionSharp] Improve SvnError? to/from exception interface

- Clear SvnError? when constructing an exception from it
- Add a way to retreive AprErr? code from exception

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/SubversionSharp/dev/src/SvnError.cs

    r8 r18  
    2424        { 
    2525            public int apr_err; 
    26             public SByte *message; 
     26            public IntPtr message; 
    2727            public svn_error_t *child; 
    2828            public IntPtr pool; 
    29             public SByte *file; 
     29            public IntPtr file; 
    3030            public int line; 
    3131        } 
     
    4141            mError = ptr.ToPointer(); 
    4242        } 
     43         
     44        public static SvnError NoError; 
    4345         
    4446        public bool IsNoError 
     
    7779        #endregion 
    7880         
     81        #region Wrapper methods 
     82        public static SvnError Create(int aprErr, SvnError err, string str) 
     83        { 
     84            return(new SvnError(Svn.svn_error_create(aprErr, new IntPtr(err.mError), str))); 
     85        } 
     86 
     87        public void Clear() 
     88        { 
     89            CheckPtr(); 
     90            Svn.svn_error_clear(new IntPtr(mError)); 
     91        } 
     92        #endregion 
     93 
    7994        #region Wrapper properties 
    8095        public int AprErr 
     
    87102        }         
    88103 
    89         public string Message 
     104        public AprString Message 
    90105        { 
    91106            get 
    92107            { 
    93108                CheckPtr(); 
    94                 return(new String(mError->message)); 
    95             }             
     109                return(mError->message); 
     110            } 
    96111        }         
    97112 
     
    114129        }         
    115130 
    116         public string File 
     131        public AprString File 
    117132        { 
    118133            get 
    119134            { 
    120135                CheckPtr(); 
    121                 return(new String(mError->file)); 
     136                return(mError->file); 
    122137            }             
    123138        }         
  • trunk/SubversionSharp/dev/src/SvnException.cs

    r7 r18  
    3939 
    4040        public SvnException(SvnError error)  
    41                : base ( error.Message
     41               : base ( error.Message.ToString()
    4242        { 
    4343            HResult = unchecked (Result + error.AprErr); 
     44            error.Clear(); 
    4445        } 
    4546         
    4647        public SvnException(SvnError error, Exception innerException)  
    47                : base ( error.Message, innerException ) 
     48               : base ( error.Message.ToString(), innerException ) 
    4849        { 
    4950            HResult = unchecked (Result + error.AprErr); 
     51            error.Clear(); 
    5052        } 
    5153 
     
    5456        { 
    5557        } 
     58         
     59        public virtual int AprErr 
     60        { 
     61            get 
     62            { 
     63                return( unchecked(HResult - Result) ); 
     64            } 
     65        } 
    5666    } 
    5767} 
  • trunk/SubversionSharp/dev/src/SvnNullReferenceException.cs

    r2 r18  
    5353        { 
    5454        } 
     55 
     56        public override int AprErr 
     57        { 
     58            get 
     59            { 
     60                return( unchecked(HResult - Result) ); 
     61            } 
     62        } 
    5563    } 
    5664}