Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Dec 11, 2020
1 parent 229debc commit cb1beb8
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 44 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,46 @@
# [1.0.0](https://github.com/rafamel/errorish/compare/v0.5.0...v1.0.0) (2020-12-11)


### Bug Fixes

* **deps:** updates dependencies ([9905c58](https://github.com/rafamel/errorish/commit/9905c58a4979df48219823a3b5308bbe2eb7962c))


### Code Refactoring

* **utils:** removes rejects and throws ([6c9dc85](https://github.com/rafamel/errorish/commit/6c9dc853d85ec2a56314d77fd45a402919643c92))


### Features

* **utils:** ensure creates an Exception by default ([0559541](https://github.com/rafamel/errorish/commit/0559541cc51bb93aea892b5738e35558613e774b))
* adds Exception class ([e5ba311](https://github.com/rafamel/errorish/commit/e5ba311984a1e0233711b66e88bea48259780fb6))
* **utils:** adds capture ([55d5e70](https://github.com/rafamel/errorish/commit/55d5e703b8637f5822cdbc195be6d04cb0807dbd))


### improvement

* **utils:** ensure doesn't capture new errors by default ([9f78375](https://github.com/rafamel/errorish/commit/9f7837529697a9bbdb04f9da48323a3551f75161))
* **utils:** ensure no longer takes an EnsureCreateOptions object as a second argument ([295da27](https://github.com/rafamel/errorish/commit/295da279365290d119d4e36b66b30729c1d69eea))


### BREAKING CHANGES

* **utils:** The ensure function used to capture the stack trace of new errors created within
it, even when not explicitly passed an option to. The latest implementation doesn't capture the
stack trace of newly created errors by default.
* **utils:** When not provided with a `create` function as an argument, `ensure` will create and
return an Exception instead of a plain Error when its first argument is not an error. This Exception
instance will have its data `field` populated with the element passed `ensure` as an *error*.
* **utils:** `ensure` used to take an EnsureCreateOptions object as a second argument allowing
to specify the input types that, when not an error, would be casted into a string for the new Error
to have as message. The new implementation casts all non Error input types into a string to use as a
message. Otherwise, passing an Error creating function as a second argument remains possible.
* **utils:** The utility functions rejects and throws have been removed from the library as they didn't add any significant value over ensure -they acted as minimal wrappers.
* Errorish has been replaced by the Exception class. The change is not merely of name, as the api surface has been vastly reduced. Please review the most current documentation.



# [0.5.0](https://github.com/rafamel/errorish/compare/v0.4.0...v0.5.0) (2019-12-23)


Expand Down
33 changes: 16 additions & 17 deletions docs/classes/exception.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Exception | errorish 0.5.0</title>
<title>Exception | errorish 1.0.0</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
Expand All @@ -22,7 +22,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">errorish 0.5.0</a>
<a href="../index.html" class="title">errorish 1.0.0</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
Expand Down Expand Up @@ -150,12 +150,12 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> Label</h3>
<div class="tsd-signature tsd-kind-icon">Label<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L5">src/Exception.ts:5</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L5">src/Exception.ts:5</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>An identifying label for exceptions that could indicate scope or origin</p>
<p>An identifying label for exceptions to indicate their scope or origin</p>
</div>
</div>
</section>
Expand All @@ -172,7 +172,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L55">src/Exception.ts:55</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L48">src/Exception.ts:48</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -218,7 +218,7 @@ <h3>data</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/exception.like.html">Like</a>.<a href="../interfaces/exception.like.html#data">data</a></p>
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L50">src/Exception.ts:50</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L46">src/Exception.ts:46</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -234,13 +234,12 @@ <h3>error</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/exception.like.html">Like</a>.<a href="../interfaces/exception.like.html#error">error</a></p>
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L55">src/Exception.ts:55</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L48">src/Exception.ts:48</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Either the source or original error that caused the exception or,
when absent, a reference to itself.</p>
<p>A source error causing the exception or a reference to itself.</p>
</div>
</div>
</section>
Expand All @@ -251,7 +250,7 @@ <h3>label</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/exception.like.html">Like</a>.<a href="../interfaces/exception.like.html#label">label</a></p>
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L46">src/Exception.ts:46</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L44">src/Exception.ts:44</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -307,7 +306,7 @@ <h3>name</h3>
<aside class="tsd-sources">
<p>Overrides Error.name</p>
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L80">src/Exception.ts:80</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L72">src/Exception.ts:72</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -333,7 +332,7 @@ <h3>root</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L88">src/Exception.ts:88</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L80">src/Exception.ts:80</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -355,7 +354,7 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> from</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L36">src/Exception.ts:36</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L36">src/Exception.ts:36</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -393,15 +392,15 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> is</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L24">src/Exception.ts:24</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L24">src/Exception.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Tests whether an item is an instance of the <code>Exception</code> class,
<p>Tests whether an item is an instance of the <code>Exception</code> class
or any class inheriting from it.
When <code>item</code> is an <code>Exception</code>, it can optionally test for
it having a particular <code>label</code>.</p>
When <code>item</code> is an <code>Exception</code>, it will optionally
test for the instance also having a specific <code>label</code>.</p>
</div>
</div>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
Expand Down
14 changes: 7 additions & 7 deletions docs/globals.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>errorish 0.5.0</title>
<title>errorish 1.0.0</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
Expand All @@ -22,7 +22,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">errorish 0.5.0</a>
<a href="index.html" class="title">errorish 1.0.0</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
Expand Down Expand Up @@ -52,7 +52,7 @@
<a href="globals.html">Globals</a>
</li>
</ul>
<h1> errorish 0.5.0</h1>
<h1> errorish 1.0.0</h1>
</div>
</div>
</header>
Expand Down Expand Up @@ -101,7 +101,7 @@ <h3>Normal<wbr>Error</h3>
<div class="tsd-signature tsd-kind-icon">Normal<wbr>Error&lt;T&gt;<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">T</span><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">"stack"</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/normalize.ts#L18">src/utils/normalize.ts:18</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/normalize.ts#L18">src/utils/normalize.ts:18</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -129,7 +129,7 @@ <h3>capture</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/capture.ts#L7">src/utils/capture.ts:7</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/capture.ts#L7">src/utils/capture.ts:7</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -164,7 +164,7 @@ <h3>ensure</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/ensure.ts#L39">src/utils/ensure.ts:39</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/ensure.ts#L39">src/utils/ensure.ts:39</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -222,7 +222,7 @@ <h3>normalize</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/normalize.ts#L24">src/utils/normalize.ts:24</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/normalize.ts#L24">src/utils/normalize.ts:24</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
9 changes: 6 additions & 3 deletions docs/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>errorish 0.5.0</title>
<title>errorish 1.0.0</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
Expand All @@ -22,7 +22,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">errorish 0.5.0</a>
<a href="index.html" class="title">errorish 1.0.0</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
Expand Down Expand Up @@ -52,7 +52,7 @@
<a href="globals.html">Globals</a>
</li>
</ul>
<h1> errorish 0.5.0</h1>
<h1> errorish 1.0.0</h1>
</div>
</div>
</header>
Expand All @@ -70,6 +70,9 @@ <h1>Errorish</h1>
<a href="https://snyk.io/test/npm/errorish"><img src="https://img.shields.io/snyk/vulnerabilities/npm/errorish.svg" alt="Vulnerabilities"></a>
<a href="https://github.com/rafamel/errorish/blob/master/LICENSE"><img src="https://img.shields.io/github/license/rafamel/errorish.svg" alt="License"></a>
<a href="https://www.npmjs.com/package/errorish"><img src="https://img.shields.io/npm/types/errorish.svg" alt="Types"></a></p>
<blockquote>
<p>When you have an error-ish but what you really want is an Error.</p>
</blockquote>
<a href="#install" id="install" style="color: inherit; text-decoration: none;">
<h2>Install</h2>
</a>
Expand Down
10 changes: 5 additions & 5 deletions docs/interfaces/ensureoptions.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>EnsureOptions | errorish 0.5.0</title>
<title>EnsureOptions | errorish 1.0.0</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
Expand All @@ -22,7 +22,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">errorish 0.5.0</a>
<a href="../index.html" class="title">errorish 1.0.0</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
Expand Down Expand Up @@ -101,7 +101,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> Error</h3>
<div class="tsd-signature tsd-kind-icon">Error<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Constructor</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">E</span><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/ensure.ts#L25">src/utils/ensure.ts:25</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/ensure.ts#L25">src/utils/ensure.ts:25</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -119,7 +119,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> capture</h3>
<div class="tsd-signature tsd-kind-icon">capture<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">true</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/ensure.ts#L18">src/utils/ensure.ts:18</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/ensure.ts#L18">src/utils/ensure.ts:18</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -136,7 +136,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> normalize</h3>
<div class="tsd-signature tsd-kind-icon">normalize<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><a href="normalizeoptions.html" class="tsd-signature-type">NormalizeOptions</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/utils/ensure.ts#L12">src/utils/ensure.ts:12</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/utils/ensure.ts#L12">src/utils/ensure.ts:12</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
12 changes: 6 additions & 6 deletions docs/interfaces/exception.like.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Like | errorish 0.5.0</title>
<title>Like | errorish 1.0.0</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
Expand All @@ -22,7 +22,7 @@
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">errorish 0.5.0</a>
<a href="../index.html" class="title">errorish 1.0.0</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
Expand Down Expand Up @@ -121,7 +121,7 @@ <h3>data</h3>
<div class="tsd-signature tsd-kind-icon">data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">D</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L11">src/Exception.ts:11</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L11">src/Exception.ts:11</a></li>
</ul>
</aside>
</section>
Expand All @@ -131,7 +131,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> error</h3>
<div class="tsd-signature tsd-kind-icon">error<span class="tsd-signature-symbol">:</span> <a href="../classes/exception.html#error-1" class="tsd-signature-type">Error</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L10">src/Exception.ts:10</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L10">src/Exception.ts:10</a></li>
</ul>
</aside>
</section>
Expand All @@ -141,7 +141,7 @@ <h3>label</h3>
<div class="tsd-signature tsd-kind-icon">label<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">L</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L8">src/Exception.ts:8</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L8">src/Exception.ts:8</a></li>
</ul>
</aside>
</section>
Expand All @@ -151,7 +151,7 @@ <h3>message</h3>
<div class="tsd-signature tsd-kind-icon">message<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/516d382/src/Exception.ts#L9">src/Exception.ts:9</a></li>
<li>Defined in <a href="https://github.com/rafamel/errorish/blob/229debc/src/Exception.ts#L9">src/Exception.ts:9</a></li>
</ul>
</aside>
</section>
Expand Down

0 comments on commit cb1beb8

Please sign in to comment.