You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you trace the supported error types for this example, you'll find:
:hackney:request/5 return spec includes {:error, term()}
AWS.HTTPClient.request/5 return spec includes {:error, term()}
AWS.Request.request_rest/9 and AWS.Client.request/6 do not define a type spec, but pass through {:error, _} from the HTTPClient
AWS.S3.get_object/23 return spec does not allow for {:error, term()}. However, the last function call is to AWS.Request.request_rest/9, so there is a discrepancy here on allowable returns
I confirmed that adding {:error, term()} to the return spec on AWS.S3.get_object/23 fixes this dialyzer error, and I'm prepared to submit a proper PR to the codegen for this.
However, this is obviously not ideal since it counteracts the intention of the more prescriptive error response type specs. In other words, in dialyzer's eyes, allowing term() means t:get_object_errors/0 is irrelevant.
Looking for guidance on a proper way to fix the type discrepancy. Thanks!
The text was updated successfully, but these errors were encountered:
I'll have a look earliest on Friday at this. Need some time to dive into this in suggest a good way forward. Quick thought, I don't have a problem per sé with your suggestion here. I agree it'll make the spec partially redundant but it's something we've also done in aws-erlang (See: aws_s3.erl#L8446-L8449) so I'm not necessarily opposed to your suggestion just to get you to move forward 👍
Dialyzer fails to validate the following code, which I believe to be correct usage of aws-elixir.
The error is
If you trace the supported error types for this example, you'll find:
:hackney:request/5
return spec includes{:error, term()}
AWS.HTTPClient.request/5
return spec includes{:error, term()}
AWS.Request.request_rest/9
andAWS.Client.request/6
do not define a type spec, but pass through{:error, _}
from theHTTPClient
AWS.S3.get_object/23
return spec does not allow for{:error, term()}
. However, the last function call is toAWS.Request.request_rest/9
, so there is a discrepancy here on allowable returnsI confirmed that adding
{:error, term()}
to the return spec onAWS.S3.get_object/23
fixes this dialyzer error, and I'm prepared to submit a proper PR to the codegen for this.However, this is obviously not ideal since it counteracts the intention of the more prescriptive error response type specs. In other words, in dialyzer's eyes, allowing
term()
meanst:get_object_errors/0
is irrelevant.Looking for guidance on a proper way to fix the type discrepancy. Thanks!
The text was updated successfully, but these errors were encountered: