diff --git a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs index 36b8553359..a962758da4 100644 --- a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs +++ b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs @@ -116,14 +116,13 @@ private string GetPagingSetting(CompositeType body, Dictionary e if (!findNextLink) { - throw new Exception("Couldn't find the nextLink property specified by extension"); + throw new KeyNotFoundException("Couldn't find the nextLink property specified by extension"); } if (!findItem) { - throw new Exception("Couldn't find the item property specified by extension"); + throw new KeyNotFoundException("Couldn't find the item property specified by extension"); } - // TODO: Need to validate the nextLinkName is in the type var pageModel = new PageTemplateModel(className, nextLinkName, itemName, valueTypeName); if (!pageModels.Contains(pageModel)) {