Closed kiwiroy closed 4 years ago
Would it be better to return a rejected Mojo::Promise rather than Carp::croak in call_p?
Mojo::Promise
Carp::croak
call_p
https://github.com/jhthorsen/openapi-client/blob/5b53b799a53712ecea77325aea144c19432550d4/lib/OpenAPI/Client.pm#L37-L41
Changing to this.
my $code = $self->can("${op}_p") or return Mojo::Promise->new->reject("[OpenAPI::Client] No such operationId");
Allows the usual
$api->call_p('incorrect?')->then(sub { ... }, sub { $error = shift; })->wait;
This sounds to me like it would be far more idiomatic.
Closing this in favor of #25.
Would it be better to return a rejected
Mojo::Promise
rather thanCarp::croak
incall_p
?https://github.com/jhthorsen/openapi-client/blob/5b53b799a53712ecea77325aea144c19432550d4/lib/OpenAPI/Client.pm#L37-L41
Changing to this.
Allows the usual