Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when project in Kentico Cloud has not activated the delivery API #44

Closed
hades200082 opened this issue Nov 18, 2017 · 6 comments
Closed

Comments

@hades200082
Copy link
Contributor

hades200082 commented Nov 18, 2017

The Delivery API is not active by default on new projects.

This causes an unhandled exception when trying to run the generator against that project.

Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Aggregate[TSource](IEnumerable`1 source, Func`3 func)
   at CloudModelGenerator.TypeProviderCodeGenerator.GenerateCode() in C:\projects\cloud-generators-net\src\CloudModelGenerator\TypeProviderCodeGenerator.cs:line 46
   at CloudModelGenerator.CodeGenerator.GenerateTypeProvider() in C:\projects\cloud-generators-net\src\CloudModelGenerator\CodeGenerator.cs:line 61
   at CloudModelGenerator.Program.<>c__DisplayClass4_0.<Main>b__0() in C:\projects\cloud-generators-net\src\CloudModelGenerator\Program.cs:line 57
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at CloudModelGenerator.Program.Main(String[] args) in C:\projects\cloud-generators-net\src\CloudModelGenerator\Program.cs:line 67
@petrsvihlik
Copy link
Contributor

petrsvihlik commented Nov 19, 2017

Right, the app should output a friendly message. Something like:

The project (guid) is not accessible. Please make sure you've enabled the delivery API.

@kashifsoofi
Copy link
Contributor

Is there a project id to be used for testing?

@petrsvihlik
Copy link
Contributor

You can register at https://app.kenticocloud.com/ for free and use the generated sample project or you can create a new project and make sure you don't enable the Delivery API.

Also, it shouldn't throw an exception when you use a random Guid (Guid that's not associated with any project). I guess the API will treat both situations in the same way so this could be another way to test it.

@kashifsoofi
Copy link
Contributor

This can be closed if the solution implemented is acceptable.

@petrsvihlik
Copy link
Contributor

it's great that now it doesn't throw an exception.
i think we should go a one step further and show a friendly message (see above) instead of:

0 content type models were successfully created.
CustomTypeProvider class was not created.

because this is quite confusing

JanLenoch pushed a commit that referenced this issue Jan 19, 2018
#44 Display a friendly message to indicate possible problem.
@JanLenoch
Copy link

Fixed by #49 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants