Skip to content

Commit

Permalink
Using custom deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cblage committed Mar 17, 2018
1 parent a39a85e commit f422831
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 55 deletions.
6 changes: 3 additions & 3 deletions doc/JSON.Decoder.UnexpectedTokenError.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h2>
<a href="#message/1">message(exception)</a>
</div>

<div class="summary-synopsis"><p>Callback implementation for <a href="https://hexdocs.pm/elixir/Exception.html#c:message/1"><code class="inline">Exception.message/1</code></a></p>
<div class="summary-synopsis"><p>Invalid JSON - Unexpected token</p>
</div>

</div>
Expand Down Expand Up @@ -175,7 +175,7 @@ <h1 class="section-heading">
</a>
<span class="signature">message(exception)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L20" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L24" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand All @@ -184,7 +184,7 @@ <h1 class="section-heading">

</div>
<section class="docstring">
<p>Callback implementation for <a href="https://hexdocs.pm/elixir/Exception.html#c:message/1"><code class="inline">Exception.message/1</code></a>.</p>
<p> Invalid JSON - Unexpected token</p>

</section>
</div>
Expand Down
6 changes: 3 additions & 3 deletions doc/JSON.Decoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h1>
<small class="visible-xs">json v1.0.3</small>
JSON.Decoder <small>protocol</small>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L23" title="View Source" class="view-source" rel="help">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L27" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down Expand Up @@ -155,7 +155,7 @@ <h1 class="section-heading">
</a>
<span class="signature">t()</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L23" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L27" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down Expand Up @@ -197,7 +197,7 @@ <h1 class="section-heading">
</a>
<span class="signature">decode(bitstring_or_char_list)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L32" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/decoder.ex#L36" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down
13 changes: 9 additions & 4 deletions doc/JSON.Encoder.Error.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ <h1>
</h1>


<section id="moduledoc">
<p>Thrown when an encoder error happens</p>

</section>



<section id="summary" class="details-list">
Expand Down Expand Up @@ -113,7 +118,7 @@ <h2>
<a href="#message/1">message(exception)</a>
</div>

<div class="summary-synopsis"><p>Callback implementation for <a href="https://hexdocs.pm/elixir/Exception.html#c:message/1"><code class="inline">Exception.message/1</code></a></p>
<div class="summary-synopsis"><p>Invalid Term</p>
</div>

</div>
Expand Down Expand Up @@ -147,7 +152,7 @@ <h1 class="section-heading">
</a>
<span class="signature">exception(args)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L2" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L5" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand All @@ -170,7 +175,7 @@ <h1 class="section-heading">
</a>
<span class="signature">message(exception)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L4" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L10" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand All @@ -179,7 +184,7 @@ <h1 class="section-heading">

</div>
<section class="docstring">
<p>Callback implementation for <a href="https://hexdocs.pm/elixir/Exception.html#c:message/1"><code class="inline">Exception.message/1</code></a>.</p>
<p> Invalid Term</p>

</section>
</div>
Expand Down
6 changes: 3 additions & 3 deletions doc/JSON.Encoder.Helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h1>
<small class="visible-xs">json v1.0.3</small>
JSON.Encoder.Helpers

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L264" title="View Source" class="view-source" rel="help">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L270" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down Expand Up @@ -153,7 +153,7 @@ <h1 class="section-heading">
</a>
<span class="signature">dict_encode(coll)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L281" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L287" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand All @@ -177,7 +177,7 @@ <h1 class="section-heading">
</a>
<span class="signature">enum_encode(coll)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L273" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L279" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down
8 changes: 4 additions & 4 deletions doc/JSON.Encoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h1>
<small class="visible-xs">json v1.0.3</small>
JSON.Encoder <small>protocol</small>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L14" title="View Source" class="view-source" rel="help">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L20" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down Expand Up @@ -164,7 +164,7 @@ <h1 class="section-heading">
</a>
<span class="signature">t()</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L14" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L20" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down Expand Up @@ -206,7 +206,7 @@ <h1 class="section-heading">
</a>
<span class="signature">encode(term)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L35" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L41" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down Expand Up @@ -248,7 +248,7 @@ <h2 id="encode/1-examples" class="section-heading">
</a>
<span class="signature">typeof(term)</span>

<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L60" class="view-source" rel="help" title="View Source">
<a href="https://github.com/cblage/elixir-json/blob/master/lib/json/encoder.ex#L66" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
Expand Down
3 changes: 3 additions & 0 deletions doc/api-reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ <h2 id="exceptions" class="section-heading">
<div class="summary-row">
<div class="summary-signature"><a href="JSON.Encoder.Error.html">JSON.Encoder.Error</a></div>

<div class="summary-synopsis"><p>Thrown when an encoder error happens</p>
</div>

</div>

</div>
Expand Down
31 changes: 0 additions & 31 deletions lib/json/decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,13 @@ defmodule JSON.Decoder.Error do
Thrown when an unknown decoder error happens
"""
defexception [message: "Invalid JSON - unknown error"]

@doc """
Invalid JSON
"""
@spec message(__MODULE__.t) :: String.t
def message(exception)

@doc """
Invalid JSON
"""
@spec exception(term) :: __MODULE__.t
def exception(term)
end

defmodule JSON.Decoder.UnexpectedEndOfBufferError do
@moduledoc """
Thrown when the json payload is incomplete
"""
defexception [message: "Invalid JSON - unexpected end of buffer"]

@doc """
Invalid JSON - unexpected end of buffer
"""
@spec message(__MODULE__.t) :: String.t
def message(exception)

@doc """
Invalid JSON - unexpected end of buffer
"""
@spec exception(term) :: __MODULE__.t
def exception(term)
end

defmodule JSON.Decoder.UnexpectedTokenError do
Expand All @@ -45,14 +21,7 @@ defmodule JSON.Decoder.UnexpectedTokenError do
@doc """
Invalid JSON - Unexpected token
"""
@spec message(__MODULE__.t) :: String.t
def message(exception), do: "Invalid JSON - unexpected token >>#{exception.token}<<"

@doc """
Invalid JSON - unexpected token
"""
@spec exception(term) :: __MODULE__.t
def exception(term)
end

defprotocol JSON.Decoder do
Expand Down
7 changes: 0 additions & 7 deletions lib/json/encoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@ defmodule JSON.Encoder.Error do
"""
defexception [error_info: nil]

@doc """
Invalid term to Encode
"""
@spec exception(term) :: __MODULE__.t
def exception(term)

@doc """
Invalid Term
"""
@spec message(__MODULE__.t) :: String.t
def message(exception) do
error_message = "An error occurred while encoding the JSON object"
if nil != exception.error_info do
Expand Down

0 comments on commit f422831

Please sign in to comment.