   @spec from_erl(:calendar.date()) :: {:ok, Date.t} | {:error, atom}
   def from_erl({year, month, day}) do
     new(year, month, day)
+  end
+
+  @doc """
+  Converts an Erlang date tuple but raises for invalid dates.
+
+  ## Examples
+
+      iex> Date.from_erl!({2000, 1, 1})
+      %Date{year: 2000, month: 1, day: 1}
+      iex> Date.from_erl!({2000, 13, 1})
+      ** (ArgumentError) cannot convert {2000, 13, 1} to date, reason: :invalid_date
+  """
+  @spec from_erl!(:calendar.date()) :: Date.t | no_return
+  def from_erl!(tuple) do
+    case from_erl(tuple) do
+      {:ok, value} ->
+        value
+      {:error, reason} ->
+        raise ArgumentError, "cannot convert #{inspect tuple} to date, reason: #{inspect reason}"
+    end
   end
 end
 

      iex> NaiveDateTime.from_erl({{2000, 13, 1},{13, 30, 15}})
      {:error, :invalid_date}
  """
  @spec from_erl(:calendar.datetime(), Calendar.microsecond) :: {:ok, __MODULE__.t} | {:error, atom}
  def from_erl({{year, month, day}, {hour, minute, second}}, microsecond \\ 0) do
    new(year, month, day, hour, minute, second, microsecond)
  end
end


  end

  @doc """
  Parses the extended "Date and time of day" format described by ISO8601:2004.

  Raises it the format is invalid.

  ## Examples

      iex> NaiveDateTime.from_iso8601!("2015-01-23T23:50:07.123Z")
      %NaiveDateTime{year: 2015, month: 01, day: 23, hour: 23, minute: 50, second: 07, microsecond: 123000}
      iex> NaiveDateTime.from_iso8601!("2015-01-23P23:50:07")
      ** (ArgumentError) cannot parse "2015-01-23P23:50:07" as naive date time, reason: :invalid_format

  """
  @spec from_iso8601!(String.t) :: NaiveDateTime.t | no_return
  def from_iso8601!(string) do
    case from_iso8601(string) do
      {:ok, value} ->
        value
      {:error, reason} ->
        raise ArgumentError, "cannot parse #{inspect string} as naive date time, reason: #{inspect reason}"
    end
  end

  @doc """
  Converts the given naive date time to ISO8601.

  Only supports converting naive date times which are in the ISO calendar,
