mgallo / openai.ex

community-maintained OpenAI API Wrapper written in Elixir.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle nginx Error

Miserlou opened this issue · comments

Got an unexpected error when there servers were misconfigured:

** (CaseClauseError) no case clause matching: {:ok, %HTTPoison.Response{status_code: 503, body: {:error, {:unexpected_token, "<html>\r\n<head><title>503 Service Temporarily Unavailable</title></head>\r\n<body>\r\n<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>"}},

Would love this would give an :error

fixed in 0.5.2.
Sorry, I trusted HTTPPoison.Error in the clauses, but in this case it did not work, now it should cover all kinds of errors