diff --git a/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs b/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs index 65618865..0a4d9e18 100644 --- a/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs +++ b/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs @@ -99,7 +99,6 @@ namespace Spring.Data.Support set { dbProvider = value; - fallbackTranslator = new FallbackExceptionTranslator(); errorCodes = dbProvider.DbMetadata.ErrorCodes; } @@ -165,8 +164,7 @@ namespace Spring.Data.Support sql = ""; } string errorCode = ExtractErrorCode(exception); - - // First, try custom translation from overridden method. + DataAccessException dex = DoTranslate(task, sql, errorCode, exception); if (dex != null) { @@ -176,7 +174,7 @@ namespace Spring.Data.Support // Looking for a fallback... if (log.IsDebugEnabled) { - log.Debug("Unable to translate exception eith errorCode '" + errorCode + "', will use the fallback translator"); + log.Debug("Unable to translate exception with errorCode '" + errorCode + "', will use the fallback translator"); } IAdoExceptionTranslator fallback = FallbackTranslator; if (fallback != null) diff --git a/src/Spring/Spring.Data/Data/UncategorizedAdoException.cs b/src/Spring/Spring.Data/Data/UncategorizedAdoException.cs index 1c8d3845..0c2f8b29 100644 --- a/src/Spring/Spring.Data/Data/UncategorizedAdoException.cs +++ b/src/Spring/Spring.Data/Data/UncategorizedAdoException.cs @@ -84,7 +84,7 @@ namespace Spring.Data /// The offending SQL statment /// The root cause. public UncategorizedAdoException(string task, string sql, string errorCode, Exception ex) : base(task + "; uncategorized DataException for SQL [" + sql + "]; " + "ErrorCode [" + errorCode + "]; " + ex.Message, ex) - { + { this.sql = sql; this.errorCode = errorCode; } @@ -106,9 +106,25 @@ namespace Spring.Data #endregion - #region Properties - - #endregion + #region Properties + + /// + /// Return the underlying error code if available from the underlying provider. + /// + public string ErrorCode + { + get { return errorCode; } + } + + /// + /// Return the SQL that resulted in this exception. + /// + public string Sql + { + get { return sql; } + } + + #endregion #region Methods diff --git a/test/Spring/Spring.Data.Tests/Spring.Data.Tests.2010.csproj b/test/Spring/Spring.Data.Tests/Spring.Data.Tests.2010.csproj index 83be25b4..a1e41aa6 100644 --- a/test/Spring/Spring.Data.Tests/Spring.Data.Tests.2010.csproj +++ b/test/Spring/Spring.Data.Tests/Spring.Data.Tests.2010.csproj @@ -171,6 +171,7 @@ +