I have the following code:
defmodule Servy.Conv do
defstruct method: "", path: "", resp_body: "", status: nil
def full_status(conv) do
"#{conv.status} #{status_reason(conv.status)}"
end
defp status_reason(code) do
%{
200 => "OK",
201 => "Created",
401 => "Unauthorized",
403 => "Forbidden",
404 => "Not Found",
500 => "Internal Server Error"
}[code]
end
end
I get a “could not find struct” error when I update the full_status
function to def full_status(%Conv = conv) do
, even though the struct is defined above. Additionally, Visual Studio Code mentions
Cyclic module usage
When I try to do this. Any ideas?