{"record":{"id":"c771d651cef3755c","repo":"Humanizr/Humanizer","slug":"decimal-word-parsing-is-not-supported-for-the-requ","errorCode":null,"errorMessage":"Decimal word parsing is not supported for the requested culture.","messagePattern":"Decimal word parsing is not supported for the requested culture\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/Localisation/WordsToNumber/UnsupportedWordsToDecimalNumberConverter.cs","lineNumber":18,"sourceCode":"namespace Humanizer;\n\n/// <summary>\n/// Fallback converter used when a locale does not support decimal word parsing.\n/// </summary>\ninternal sealed class UnsupportedWordsToDecimalNumberConverter : IWordsToDecimalNumberConverter\n{\n    internal static UnsupportedWordsToDecimalNumberConverter Instance { get; } = new();\n\n    UnsupportedWordsToDecimalNumberConverter()\n    {\n    }\n\n    /// <inheritdoc />\n    public decimal Convert(string words)\n    {\n        ArgumentNullException.ThrowIfNull(words);\n        throw new NotSupportedException(\"Decimal word parsing is not supported for the requested culture.\");\n    }\n\n    /// <inheritdoc />\n    public bool TryConvert(string words, out decimal parsedValue)\n    {\n        parsedValue = default;\n        return false;\n    }\n\n    /// <inheritdoc />\n    public bool TryConvert(string words, out decimal parsedValue, out string? unrecognizedNumber)\n    {\n        parsedValue = default;\n        unrecognizedNumber = words ?? string.Empty;\n        return false;\n    }\n}","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/Localisation/WordsToNumber/UnsupportedWordsToDecimalNumberConverter.cs#L1-L35","documentation":"UnsupportedWordsToDecimalNumberConverter.Convert throws NotSupportedException at line 18 to signal that the resolved culture has no decimal word parser. The decimal registry returns this stub for cultures without authored decimal words (unlike the integer registry, it does not fall back to English). Notably TryConvert returns false rather than throwing, so callers can avoid the exception entirely.","triggerScenarios":"Calling ToDecimalNumber(words, culture) for a culture that lacks decimal-word support. The stub is returned by GetWordsToDecimalNumberConverter; Convert throws, but TryConvert returns false.","commonSituations":"Requesting decimal parsing for a locale that only authored integer words; assuming decimal words exist for every culture; using a neutral/unsupported culture code.","solutions":["Use TryToDecimalNumber(words, out var d, culture) which returns false without throwing.","Verify the culture has decimal-word support before calling Convert; fall back to a supported culture (e.g. en) if needed.","Catch NotSupportedException only as a last resort if you must call Convert."],"exampleFix":"// before\nvar d = words.ToDecimalNumber(CultureInfo.GetCultureInfo(\"xx\"));  // throws NotSupportedException\n// after\nif (words.TryToDecimalNumber(out var d, CultureInfo.GetCultureInfo(\"xx\")))\n    Use(d);\nelse\n    UseFallback();","handlingStrategy":"validation","validationCode":"// Try* returns false without throwing for unsupported cultures.\nif (!words.TryToDecimalNumber(out var d, culture))\n{\n    // culture lacks decimal-word support; fall back or skip\n    return Result.Unsupported();\n}\nreturn Result.Ok(d);","typeGuard":null,"tryCatchPattern":"try { var d = words.ToDecimalNumber(culture); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"not supported for the requested culture\"))\n    { /* no decimal parser for this culture */ }","preventionTips":["Use TryToDecimalNumber to avoid NotSupportedException entirely.","Confirm the culture has authored decimal words before calling Convert.","Fall back to a supported culture (e.g. en) when decimal words are unavailable.","Do not assume every locale has a decimal parser; only the integer registry falls back to English."],"tags":["words-to-decimal","decimal","notsupportedexception","localization","unsupported-culture"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}