/// <summary> /// Gets a specific error message denpending to a type. /// </summary> /// <param name="type">The geiven type.</param> /// <returns>The error message.</returns> private string ExceptionTypeToMessage(IbanExceptionType type) { switch (type) { case IbanExceptionType.DataLoadFailure: return("Data could not be loaded"); case IbanExceptionType.NoCalculation: return("No Iban Calculation for this accountnumber"); case IbanExceptionType.BBANError: return("BBAN could not be generated."); case IbanExceptionType.IbanGeneratingError: return("IBAN could not be generated."); case IbanExceptionType.IbanGeneratingNotAllParameters: return("IBAN could not be generated because not all parameters were set."); case IbanExceptionType.IbanGeneratingFormatting: return("The generated IBAN does not match the required formatting of the country."); case IbanExceptionType.IbanGeneratingCheckDigit: return("IBAN could not be generated because check digit could not be calculated."); case IbanExceptionType.IbanValidatingFormatting: return("IBAN is not well formatted."); case IbanExceptionType.BankIdentNotValid: return("The bank ident does not fit the formatting rule."); case IbanExceptionType.IbanValidationIbanNeeded: return("For validating an iban please submit the iban code."); case IbanExceptionType.GetBicNoAllowedForCountry: return("Getting a bic is not supported for this country yet"); default: return("An error occured!"); } }
/// <summary> /// Gets a specific error message denpending to a type. /// </summary> /// <param name="type">The geiven type.</param> /// <returns>The error message.</returns> private string ExceptionTypeToMessage(IbanExceptionType type) { switch (type) { case IbanExceptionType.DataLoadFailure: return "Data could not be loaded"; case IbanExceptionType.NoCalculation: return "No Iban Calculation for this accountnumber"; case IbanExceptionType.BBANError: return "BBAN could not be generated."; case IbanExceptionType.IbanGeneratingError: return "IBAN could not be generated."; case IbanExceptionType.IbanGeneratingNotAllParameters: return "IBAN could not be generated because not all parameters were set."; case IbanExceptionType.IbanGeneratingFormatting: return "The generated IBAN does not match the required formatting of the country."; case IbanExceptionType.IbanGeneratingCheckDigit: return "IBAN could not be generated because check digit could not be calculated."; case IbanExceptionType.IbanValidatingFormatting: return "IBAN is not well formatted."; case IbanExceptionType.BankIdentNotValid: return "The bank ident does not fit the formatting rule."; case IbanExceptionType.IbanValidationIbanNeeded: return "For validating an iban please submit the iban code."; case IbanExceptionType.GetBicNoAllowedForCountry: return "Getting a bic is not supported for this country yet"; default: return "An error occured!"; } }
/// <summary> /// Construcor. /// </summary> /// <param name="ex">The inner exception.</param> /// <param name="type">The type of the exception.</param> public IbanException(Exception ex, IbanExceptionType type) : base(ex.Message, ex) { this.ExceptionType = type; this._exceptionMessage = this.ExceptionTypeToMessage(type); }
/// <summary> /// Constructor. /// </summary> /// <param name="type">The type of the exception.</param> public IbanException(IbanExceptionType type) : base() { this.ExceptionType = type; this._exceptionMessage = this.ExceptionTypeToMessage(type); }