diff --git a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs index d87b80c2fc2ae..f4922e4867faa 100644 --- a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs +++ b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs @@ -88,7 +88,7 @@ private static void NormalizeApiVersion(ServiceClient serviceClient) } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "nextLink")] - private string GetPagingSetting(CompositeType body, Dictionary extensions, string valueTypeName, IDictionary typePageClasses) + private string GetPagingSetting(CompositeType body, Dictionary extensions, string valueTypeName, IDictionary typePageClasses, String methodName) { var ext = extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer; @@ -118,7 +118,7 @@ private string GetPagingSetting(CompositeType body, Dictionary e if (!ignoreNextLink && !findNextLink) { - throw new KeyNotFoundException("Couldn't find the nextLink property specified by extension"); + throw new KeyNotFoundException(String.Format(CultureInfo.InvariantCulture, "Couldn't find the nextLink property specified by extension on operation {0} and property {1}", methodName, body.SerializedName)); } if (!findItem) { @@ -184,7 +184,7 @@ private void NormalizePaginatedMethods(ServiceClient serviceClient) { pageClasses.Add(valueType, new Dictionary()); } - string pagableTypeName = GetPagingSetting(compositType, method.Extensions, valueType, pageClasses[valueType]); + string pagableTypeName = GetPagingSetting(compositType, method.Extensions, valueType, pageClasses[valueType], method.SerializedName); CompositeType pagedResult = new CompositeType {