Skip to content

CleanAddressErrorHelper

Static helper that decodes the concatenated two-character USPS/CorrectAddress error-code string returned by the address-cleansing web service into a parallel list of codes and their corresponding human-readable descriptions, per the CorrectAddress user manual (v9.0, page C-2).

Purpose

  • Splits a packed USPS error-code string into individual two-character codes.
  • Translates each USPS error code into its documented description (e.g., "City name corrected", "Foreign address"), defaulting to a generic "code description not available" message for unrecognized codes.

Context

  • Namespace: SAIF.Services.Utilities.CleanAddress
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
ParseErrors public static ICleanAddressErrors ParseErrors(string errorCodes) Splits errorCodes into two-character chunks and returns an ICleanAddressErrors containing both the codes and their resolved USPS descriptions.

Behavioral notes

  • Throws via Enforce.ArgumentNotNull if errorCodes is null, before any parsing occurs.
  • The private GetUspsErrorDescription switch statement hard-codes ~50 USPS-documented error codes; any code not in that table returns "<code> - Code description not available" rather than throwing.

Sources

  • Services/SAIF.Services/Utilities/CleanAddress/CleanAddressErrorHelper.cs