@magic.batua/error
Version:
The Error module powers the error handling features of the Magic Batua.
386 lines (120 loc) • 5.85 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>ClientError - Postman Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ClientError.html">ClientError</a><ul class='methods'><li data-type='method'><a href="ClientError.html#Export">Export</a></li></ul></li><li><a href="ExternalError.html">ExternalError</a><ul class='methods'><li data-type='method'><a href="ExternalError.html#Export">Export</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-Code.html">Code</a></li><li><a href="module-Error.html">Error</a><ul class='methods'><li data-type='method'><a href="module-Error.html#~Handle">Handle</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">ClientError</h1>
<section>
<header>
<h2>
ClientError
</h2>
<div class="class-description"><p>The <code>ClientError</code> class represents errors whose origin lie client-side. Incorrectly formatted
requests, wrong methods used for API calls and invalid tokens are some examples of a <code>ClientError</code>.
An appropriate error information and status code is shared with the client when a <code>ClientError</code>
is thrown.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="ClientError"><span class="type-signature"></span>new ClientError<span class="signature">(code, message, help)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Initialises a <code>ClientError</code> with the given HTTP status code, the error message and
an optional debugging help text.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>code</code></td>
<td class="type">
<span class="param-type">Code</span>
</td>
<td class="description last"><p>HTTP status code for the error response</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The error message</p></td>
</tr>
<tr>
<td class="name"><code>help</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Optional debugging help text</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Source_ClientError.js.html">Source/ClientError.js</a>, <a href="Source_ClientError.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="Export"><span class="type-signature"></span>Export<span class="signature">()</span><span class="type-signature"> → {any}</span></h4>
<div class="description">
<p>Sanitises a <code>ClientError</code> object by getting rid of the <code>code</code> property. Sending the
<code>code</code> property client-side could make the impression that client shouldn't pay
attention to the HTTP response's <code>status</code> header and should code against the response
body's <code>code</code> property instead. That would be a bad design choice.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Source_ClientError.js.html">Source/ClientError.js</a>, <a href="Source_ClientError.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A <code>ClientError</code> object without the <code>code</code>.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">any</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated at Mon Mar 19 2018 23:41:29 GMT+0530 (IST)
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>