UNPKG

@magic.batua/error

Version:

The Error module powers the error handling features of the Magic Batua.

501 lines (151 loc) 7.19 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ExternalError - 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">ExternalError</h1> <section> <header> <h2> ExternalError </h2> <div class="class-description"><p>The <code>ExternalError</code> class represents errors reported by third-party service providers the code makes use of. This includes, but is not limited to, Azure Cosmos database, the SMS provider, the Wallet API and the MVC API.</p> <p> An <code>ExternalError</code> is always reported with a status code of <code>Codes.FailedDependency</code>, i.e. <code>424</code>.</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="ExternalError"><span class="type-signature"></span>new ExternalError<span class="signature">(message, serviceProvider, help)</span><span class="type-signature"></span></h4> <div class="description"> <p>Initialises an <code>ExternalError</code> with a custom error message, the name of the service provider or API from where the error originated 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>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>serviceProvider</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>Name of the service provider or API throwing the error</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>Debugging information</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_ExternalError.js.html">Source/ExternalError.js</a>, <a href="Source_ExternalError.js.html#line19">line 19</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="code"><span class="type-signature"></span>code<span class="type-signature"></span></h4> <div class="description"> <p>The error code</p> </div> <h5 class="subsection-title">Properties:</h5> <table class="props"> <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"> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Source_ExternalError.js.html">Source/ExternalError.js</a>, <a href="Source_ExternalError.js.html#line38">line 38</a> </li></ul></dd> </dl> <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"> &rarr; {any}</span></h4> <div class="description"> <p>Sanitises a <code>ExternalError</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_ExternalError.js.html">Source/ExternalError.js</a>, <a href="Source_ExternalError.js.html#line43">line 43</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A <code>ExternalError</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>