Wrap Odoo auth in try block
This commit is contained in:
parent
7e6439be67
commit
65c9c07297
1 changed files with 9 additions and 6 deletions
|
@ -32,12 +32,15 @@ defmodule RecycledCloud.Odoo do
|
||||||
nil
|
nil
|
||||||
]
|
]
|
||||||
|
|
||||||
auth_response = %XMLRPC.MethodCall{method_name: "authenticate", params: auth_params}
|
try do
|
||||||
|> post!(@common_endpoint)
|
auth_response = %XMLRPC.MethodCall{method_name: "authenticate", params: auth_params}
|
||||||
case auth_response do
|
|> post!(@common_endpoint)
|
||||||
{:ok, false} -> {:error, "Could not authenticate against Odoo."}
|
case auth_response do
|
||||||
{:ok, uid} -> {:ok, uid}
|
{:ok, false} -> {:error, "Could not authenticate against Odoo."}
|
||||||
{:error, err} -> {:error, err}
|
{:ok, uid} -> {:ok, uid}
|
||||||
|
{:error, err} -> {:error, err}
|
||||||
|
end
|
||||||
|
rescue e -> {:error, e}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue