Skip to content

Commit 2c6aa25

Browse files
committed
Fixes type specs for http client error responses
1 parent 2ba49f0 commit 2c6aa25

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

lib/aws_codegen/types.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ defmodule AWS.CodeGen.Types do
229229
[]
230230
end
231231

232-
Enum.join([normal, "{:error, {:unexpected_response, any()}}" | errors], " | \n")
232+
Enum.join([normal, "{:error, {:unexpected_response, any()}}", "{:error, term()}" | errors], " | \n")
233233

234234
type ->
235235
normal =
@@ -242,7 +242,7 @@ defmodule AWS.CodeGen.Types do
242242
[]
243243
end
244244

245-
Enum.join([normal, "{:error, {:unexpected_response, any()}}" | errors], " | \n")
245+
Enum.join([normal, "{:error, {:unexpected_response, any()}}", "{:error, term()}" | errors], " | \n")
246246
end
247247
end
248248

test/aws_codegen_test.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ defmodule AWS.CodeGenTest do
250250
@spec put_audit_events(map(), put_audit_events_request(), list()) ::
251251
{:ok, put_audit_events_response(), any()}
252252
| {:error, {:unexpected_response, any()}}
253+
| {:error, term()}
253254
| {:error, put_audit_events_errors()}
254255
def put_audit_events(%Client{} = client, input, options \\\\ []) do
255256
url_path = \"/PutAuditEvents\"
@@ -487,6 +488,7 @@ defmodule AWS.CodeGenTest do
487488
@spec put_audit_events(map(), String.t(), String.t() | nil, list()) ::
488489
{:ok, put_audit_events_response(), any()}
489490
| {:error, {:unexpected_response, any()}}
491+
| {:error, term()}
490492
| {:error, put_audit_events_errors()}
491493
def put_audit_events(%Client{} = client, channel_arn, external_id \\\\ nil, options \\\\ []) do
492494
url_path = \"/PutAuditEvents\"
@@ -730,6 +732,7 @@ defmodule AWS.CodeGenTest do
730732
@spec put_audit_events(map(), put_audit_events_request(), list()) ::
731733
{:ok, put_audit_events_response(), any()}
732734
| {:error, {:unexpected_response, any()}}
735+
| {:error, term()}
733736
| {:error, put_audit_events_errors()}
734737
def put_audit_events(%Client{} = client, input, options \\\\ []) do
735738
url_path = \"/PutAuditEvents\"

test/fixtures/generated/data_exchange.ex

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,6 +2220,7 @@ defmodule AWS.DataExchange do
22202220
@spec accept_data_grant(map(), String.t(), accept_data_grant_request(), list()) ::
22212221
{:ok, accept_data_grant_response(), any()}
22222222
| {:error, {:unexpected_response, any()}}
2223+
| {:error, term()}
22232224
| {:error, accept_data_grant_errors()}
22242225
def accept_data_grant(%Client{} = client, data_grant_arn, input, options \\ []) do
22252226
url_path = "/v1/data-grants/#{AWS.Util.encode_uri(data_grant_arn)}/accept"
@@ -2251,6 +2252,7 @@ defmodule AWS.DataExchange do
22512252
@spec cancel_job(map(), String.t(), cancel_job_request(), list()) ::
22522253
{:ok, nil, any()}
22532254
| {:error, {:unexpected_response, any()}}
2255+
| {:error, term()}
22542256
| {:error, cancel_job_errors()}
22552257
def cancel_job(%Client{} = client, job_id, input, options \\ []) do
22562258
url_path = "/v1/jobs/#{AWS.Util.encode_uri(job_id)}"
@@ -2279,6 +2281,7 @@ defmodule AWS.DataExchange do
22792281
@spec create_data_grant(map(), create_data_grant_request(), list()) ::
22802282
{:ok, create_data_grant_response(), any()}
22812283
| {:error, {:unexpected_response, any()}}
2284+
| {:error, term()}
22822285
| {:error, create_data_grant_errors()}
22832286
def create_data_grant(%Client{} = client, input, options \\ []) do
22842287
url_path = "/v1/data-grants"
@@ -2307,6 +2310,7 @@ defmodule AWS.DataExchange do
23072310
@spec create_data_set(map(), create_data_set_request(), list()) ::
23082311
{:ok, create_data_set_response(), any()}
23092312
| {:error, {:unexpected_response, any()}}
2313+
| {:error, term()}
23102314
| {:error, create_data_set_errors()}
23112315
def create_data_set(%Client{} = client, input, options \\ []) do
23122316
url_path = "/v1/data-sets"
@@ -2335,6 +2339,7 @@ defmodule AWS.DataExchange do
23352339
@spec create_event_action(map(), create_event_action_request(), list()) ::
23362340
{:ok, create_event_action_response(), any()}
23372341
| {:error, {:unexpected_response, any()}}
2342+
| {:error, term()}
23382343
| {:error, create_event_action_errors()}
23392344
def create_event_action(%Client{} = client, input, options \\ []) do
23402345
url_path = "/v1/event-actions"
@@ -2363,6 +2368,7 @@ defmodule AWS.DataExchange do
23632368
@spec create_job(map(), create_job_request(), list()) ::
23642369
{:ok, create_job_response(), any()}
23652370
| {:error, {:unexpected_response, any()}}
2371+
| {:error, term()}
23662372
| {:error, create_job_errors()}
23672373
def create_job(%Client{} = client, input, options \\ []) do
23682374
url_path = "/v1/jobs"
@@ -2391,6 +2397,7 @@ defmodule AWS.DataExchange do
23912397
@spec create_revision(map(), String.t(), create_revision_request(), list()) ::
23922398
{:ok, create_revision_response(), any()}
23932399
| {:error, {:unexpected_response, any()}}
2400+
| {:error, term()}
23942401
| {:error, create_revision_errors()}
23952402
def create_revision(%Client{} = client, data_set_id, input, options \\ []) do
23962403
url_path = "/v1/data-sets/#{AWS.Util.encode_uri(data_set_id)}/revisions"
@@ -2419,6 +2426,7 @@ defmodule AWS.DataExchange do
24192426
@spec delete_asset(map(), String.t(), String.t(), String.t(), delete_asset_request(), list()) ::
24202427
{:ok, nil, any()}
24212428
| {:error, {:unexpected_response, any()}}
2429+
| {:error, term()}
24222430
| {:error, delete_asset_errors()}
24232431
def delete_asset(%Client{} = client, asset_id, data_set_id, revision_id, input, options \\ []) do
24242432
url_path =
@@ -2449,6 +2457,7 @@ defmodule AWS.DataExchange do
24492457
@spec delete_data_grant(map(), String.t(), delete_data_grant_request(), list()) ::
24502458
{:ok, nil, any()}
24512459
| {:error, {:unexpected_response, any()}}
2460+
| {:error, term()}
24522461
| {:error, delete_data_grant_errors()}
24532462
def delete_data_grant(%Client{} = client, data_grant_id, input, options \\ []) do
24542463
url_path = "/v1/data-grants/#{AWS.Util.encode_uri(data_grant_id)}"
@@ -2477,6 +2486,7 @@ defmodule AWS.DataExchange do
24772486
@spec delete_data_set(map(), String.t(), delete_data_set_request(), list()) ::
24782487
{:ok, nil, any()}
24792488
| {:error, {:unexpected_response, any()}}
2489+
| {:error, term()}
24802490
| {:error, delete_data_set_errors()}
24812491
def delete_data_set(%Client{} = client, data_set_id, input, options \\ []) do
24822492
url_path = "/v1/data-sets/#{AWS.Util.encode_uri(data_set_id)}"
@@ -2505,6 +2515,7 @@ defmodule AWS.DataExchange do
25052515
@spec delete_event_action(map(), String.t(), delete_event_action_request(), list()) ::
25062516
{:ok, nil, any()}
25072517
| {:error, {:unexpected_response, any()}}
2518+
| {:error, term()}
25082519
| {:error, delete_event_action_errors()}
25092520
def delete_event_action(%Client{} = client, event_action_id, input, options \\ []) do
25102521
url_path = "/v1/event-actions/#{AWS.Util.encode_uri(event_action_id)}"
@@ -2533,6 +2544,7 @@ defmodule AWS.DataExchange do
25332544
@spec delete_revision(map(), String.t(), String.t(), delete_revision_request(), list()) ::
25342545
{:ok, nil, any()}
25352546
| {:error, {:unexpected_response, any()}}
2547+
| {:error, term()}
25362548
| {:error, delete_revision_errors()}
25372549
def delete_revision(%Client{} = client, data_set_id, revision_id, input, options \\ []) do
25382550
url_path =
@@ -2563,6 +2575,7 @@ defmodule AWS.DataExchange do
25632575
@spec get_asset(map(), String.t(), String.t(), String.t(), list()) ::
25642576
{:ok, get_asset_response(), any()}
25652577
| {:error, {:unexpected_response, any()}}
2578+
| {:error, term()}
25662579
| {:error, get_asset_errors()}
25672580
def get_asset(%Client{} = client, asset_id, data_set_id, revision_id, options \\ []) do
25682581
url_path =
@@ -2582,6 +2595,7 @@ defmodule AWS.DataExchange do
25822595
@spec get_data_grant(map(), String.t(), list()) ::
25832596
{:ok, get_data_grant_response(), any()}
25842597
| {:error, {:unexpected_response, any()}}
2598+
| {:error, term()}
25852599
| {:error, get_data_grant_errors()}
25862600
def get_data_grant(%Client{} = client, data_grant_id, options \\ []) do
25872601
url_path = "/v1/data-grants/#{AWS.Util.encode_uri(data_grant_id)}"
@@ -2599,6 +2613,7 @@ defmodule AWS.DataExchange do
25992613
@spec get_data_set(map(), String.t(), list()) ::
26002614
{:ok, get_data_set_response(), any()}
26012615
| {:error, {:unexpected_response, any()}}
2616+
| {:error, term()}
26022617
| {:error, get_data_set_errors()}
26032618
def get_data_set(%Client{} = client, data_set_id, options \\ []) do
26042619
url_path = "/v1/data-sets/#{AWS.Util.encode_uri(data_set_id)}"
@@ -2616,6 +2631,7 @@ defmodule AWS.DataExchange do
26162631
@spec get_event_action(map(), String.t(), list()) ::
26172632
{:ok, get_event_action_response(), any()}
26182633
| {:error, {:unexpected_response, any()}}
2634+
| {:error, term()}
26192635
| {:error, get_event_action_errors()}
26202636
def get_event_action(%Client{} = client, event_action_id, options \\ []) do
26212637
url_path = "/v1/event-actions/#{AWS.Util.encode_uri(event_action_id)}"
@@ -2633,6 +2649,7 @@ defmodule AWS.DataExchange do
26332649
@spec get_job(map(), String.t(), list()) ::
26342650
{:ok, get_job_response(), any()}
26352651
| {:error, {:unexpected_response, any()}}
2652+
| {:error, term()}
26362653
| {:error, get_job_errors()}
26372654
def get_job(%Client{} = client, job_id, options \\ []) do
26382655
url_path = "/v1/jobs/#{AWS.Util.encode_uri(job_id)}"
@@ -2650,6 +2667,7 @@ defmodule AWS.DataExchange do
26502667
@spec get_received_data_grant(map(), String.t(), list()) ::
26512668
{:ok, get_received_data_grant_response(), any()}
26522669
| {:error, {:unexpected_response, any()}}
2670+
| {:error, term()}
26532671
| {:error, get_received_data_grant_errors()}
26542672
def get_received_data_grant(%Client{} = client, data_grant_arn, options \\ []) do
26552673
url_path = "/v1/received-data-grants/#{AWS.Util.encode_uri(data_grant_arn)}"
@@ -2667,6 +2685,7 @@ defmodule AWS.DataExchange do
26672685
@spec get_revision(map(), String.t(), String.t(), list()) ::
26682686
{:ok, get_revision_response(), any()}
26692687
| {:error, {:unexpected_response, any()}}
2688+
| {:error, term()}
26702689
| {:error, get_revision_errors()}
26712690
def get_revision(%Client{} = client, data_set_id, revision_id, options \\ []) do
26722691
url_path =
@@ -2686,6 +2705,7 @@ defmodule AWS.DataExchange do
26862705
@spec list_data_grants(map(), String.t() | nil, String.t() | nil, list()) ::
26872706
{:ok, list_data_grants_response(), any()}
26882707
| {:error, {:unexpected_response, any()}}
2708+
| {:error, term()}
26892709
| {:error, list_data_grants_errors()}
26902710
def list_data_grants(%Client{} = client, max_results \\ nil, next_token \\ nil, options \\ []) do
26912711
url_path = "/v1/data-grants"
@@ -2718,6 +2738,7 @@ defmodule AWS.DataExchange do
27182738
@spec list_data_set_revisions(map(), String.t(), String.t() | nil, String.t() | nil, list()) ::
27192739
{:ok, list_data_set_revisions_response(), any()}
27202740
| {:error, {:unexpected_response, any()}}
2741+
| {:error, term()}
27212742
| {:error, list_data_set_revisions_errors()}
27222743
def list_data_set_revisions(
27232744
%Client{} = client,
@@ -2759,6 +2780,7 @@ defmodule AWS.DataExchange do
27592780
@spec list_data_sets(map(), String.t() | nil, String.t() | nil, String.t() | nil, list()) ::
27602781
{:ok, list_data_sets_response(), any()}
27612782
| {:error, {:unexpected_response, any()}}
2783+
| {:error, term()}
27622784
| {:error, list_data_sets_errors()}
27632785
def list_data_sets(
27642786
%Client{} = client,
@@ -2803,6 +2825,7 @@ defmodule AWS.DataExchange do
28032825
@spec list_event_actions(map(), String.t() | nil, String.t() | nil, String.t() | nil, list()) ::
28042826
{:ok, list_event_actions_response(), any()}
28052827
| {:error, {:unexpected_response, any()}}
2828+
| {:error, term()}
28062829
| {:error, list_event_actions_errors()}
28072830
def list_event_actions(
28082831
%Client{} = client,
@@ -2854,6 +2877,7 @@ defmodule AWS.DataExchange do
28542877
) ::
28552878
{:ok, list_jobs_response(), any()}
28562879
| {:error, {:unexpected_response, any()}}
2880+
| {:error, term()}
28572881
| {:error, list_jobs_errors()}
28582882
def list_jobs(
28592883
%Client{} = client,
@@ -2912,6 +2936,7 @@ defmodule AWS.DataExchange do
29122936
) ::
29132937
{:ok, list_received_data_grants_response(), any()}
29142938
| {:error, {:unexpected_response, any()}}
2939+
| {:error, term()}
29152940
| {:error, list_received_data_grants_errors()}
29162941
def list_received_data_grants(
29172942
%Client{} = client,
@@ -2964,6 +2989,7 @@ defmodule AWS.DataExchange do
29642989
) ::
29652990
{:ok, list_revision_assets_response(), any()}
29662991
| {:error, {:unexpected_response, any()}}
2992+
| {:error, term()}
29672993
| {:error, list_revision_assets_errors()}
29682994
def list_revision_assets(
29692995
%Client{} = client,
@@ -3004,6 +3030,7 @@ defmodule AWS.DataExchange do
30043030
@spec list_tags_for_resource(map(), String.t(), list()) ::
30053031
{:ok, list_tags_for_resource_response(), any()}
30063032
| {:error, {:unexpected_response, any()}}
3033+
| {:error, term()}
30073034
def list_tags_for_resource(%Client{} = client, resource_arn, options \\ []) do
30083035
url_path = "/tags/#{AWS.Util.encode_uri(resource_arn)}"
30093036
headers = []
@@ -3020,6 +3047,7 @@ defmodule AWS.DataExchange do
30203047
@spec revoke_revision(map(), String.t(), String.t(), revoke_revision_request(), list()) ::
30213048
{:ok, revoke_revision_response(), any()}
30223049
| {:error, {:unexpected_response, any()}}
3050+
| {:error, term()}
30233051
| {:error, revoke_revision_errors()}
30243052
def revoke_revision(%Client{} = client, data_set_id, revision_id, input, options \\ []) do
30253053
url_path =
@@ -3053,6 +3081,7 @@ defmodule AWS.DataExchange do
30533081
@spec send_api_asset(map(), send_api_asset_request(), list()) ::
30543082
{:ok, send_api_asset_response(), any()}
30553083
| {:error, {:unexpected_response, any()}}
3084+
| {:error, term()}
30563085
| {:error, send_api_asset_errors()}
30573086
def send_api_asset(%Client{} = client, input, options \\ []) do
30583087
url_path = "/v1"
@@ -3119,6 +3148,7 @@ defmodule AWS.DataExchange do
31193148
) ::
31203149
{:ok, send_data_set_notification_response(), any()}
31213150
| {:error, {:unexpected_response, any()}}
3151+
| {:error, term()}
31223152
| {:error, send_data_set_notification_errors()}
31233153
def send_data_set_notification(%Client{} = client, data_set_id, input, options \\ []) do
31243154
url_path = "/v1/data-sets/#{AWS.Util.encode_uri(data_set_id)}/notification"
@@ -3147,6 +3177,7 @@ defmodule AWS.DataExchange do
31473177
@spec start_job(map(), String.t(), start_job_request(), list()) ::
31483178
{:ok, start_job_response(), any()}
31493179
| {:error, {:unexpected_response, any()}}
3180+
| {:error, term()}
31503181
| {:error, start_job_errors()}
31513182
def start_job(%Client{} = client, job_id, input, options \\ []) do
31523183
url_path = "/v1/jobs/#{AWS.Util.encode_uri(job_id)}"
@@ -3175,6 +3206,7 @@ defmodule AWS.DataExchange do
31753206
@spec tag_resource(map(), String.t(), tag_resource_request(), list()) ::
31763207
{:ok, nil, any()}
31773208
| {:error, {:unexpected_response, any()}}
3209+
| {:error, term()}
31783210
def tag_resource(%Client{} = client, resource_arn, input, options \\ []) do
31793211
url_path = "/tags/#{AWS.Util.encode_uri(resource_arn)}"
31803212
headers = []
@@ -3202,6 +3234,7 @@ defmodule AWS.DataExchange do
32023234
@spec untag_resource(map(), String.t(), untag_resource_request(), list()) ::
32033235
{:ok, nil, any()}
32043236
| {:error, {:unexpected_response, any()}}
3237+
| {:error, term()}
32053238
def untag_resource(%Client{} = client, resource_arn, input, options \\ []) do
32063239
url_path = "/tags/#{AWS.Util.encode_uri(resource_arn)}"
32073240
headers = []
@@ -3234,6 +3267,7 @@ defmodule AWS.DataExchange do
32343267
@spec update_asset(map(), String.t(), String.t(), String.t(), update_asset_request(), list()) ::
32353268
{:ok, update_asset_response(), any()}
32363269
| {:error, {:unexpected_response, any()}}
3270+
| {:error, term()}
32373271
| {:error, update_asset_errors()}
32383272
def update_asset(%Client{} = client, asset_id, data_set_id, revision_id, input, options \\ []) do
32393273
url_path =
@@ -3264,6 +3298,7 @@ defmodule AWS.DataExchange do
32643298
@spec update_data_set(map(), String.t(), update_data_set_request(), list()) ::
32653299
{:ok, update_data_set_response(), any()}
32663300
| {:error, {:unexpected_response, any()}}
3301+
| {:error, term()}
32673302
| {:error, update_data_set_errors()}
32683303
def update_data_set(%Client{} = client, data_set_id, input, options \\ []) do
32693304
url_path = "/v1/data-sets/#{AWS.Util.encode_uri(data_set_id)}"
@@ -3292,6 +3327,7 @@ defmodule AWS.DataExchange do
32923327
@spec update_event_action(map(), String.t(), update_event_action_request(), list()) ::
32933328
{:ok, update_event_action_response(), any()}
32943329
| {:error, {:unexpected_response, any()}}
3330+
| {:error, term()}
32953331
| {:error, update_event_action_errors()}
32963332
def update_event_action(%Client{} = client, event_action_id, input, options \\ []) do
32973333
url_path = "/v1/event-actions/#{AWS.Util.encode_uri(event_action_id)}"
@@ -3320,6 +3356,7 @@ defmodule AWS.DataExchange do
33203356
@spec update_revision(map(), String.t(), String.t(), update_revision_request(), list()) ::
33213357
{:ok, update_revision_response(), any()}
33223358
| {:error, {:unexpected_response, any()}}
3359+
| {:error, term()}
33233360
| {:error, update_revision_errors()}
33243361
def update_revision(%Client{} = client, data_set_id, revision_id, input, options \\ []) do
33253362
url_path =

0 commit comments

Comments
 (0)