jhthorsen / openapi-client

A client for talking to an Open API powered server
11 stars 17 forks source link

Always return a promise from call_p #25

Closed kiwiroy closed 4 years ago

kiwiroy commented 5 years ago

As per #24 this PR removes the croak in favour of returning a rejected promise.

mohawk2 commented 5 years ago

Looks good to me. The failures seem to be because of the incompatibility with M::P::OpenAPI, which is problematic.

kiwiroy commented 5 years ago

@mohawk2 there’s jhthorsen/mojolicious-plugin-openapi#135 and associates for build issues

jhthorsen commented 4 years ago

@kiwiroy: The reason for croak is that I want to give the programmer instant feedback that something is wrong here. The other option would simply be to remove the "or" and let Perl tell you the same thing.

I do however see that the croak message is not very good: It should include the name of the operation you try to call.

What is the usecase for returning a promise?

jhthorsen commented 4 years ago

This is actually what I do in my home brewed OpenAPI JavaScript client, so I guess I retract my previous comment 🙈