UNPKG

@magic.batua/error

Version:

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

262 lines (92 loc) 4.46 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error - 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">Error</h1> <section> <header> </header> <article> <div class="container-overview"> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="~Handle"><span class="type-signature">(inner) </span>Handle<span class="signature">(error, response)</span><span class="type-signature"></span></h4> <div class="description"> <p>All the errors thrown by the application code, in any of the modules, are routed through this method.</p> <p> Upon receiving an <code>error</code>, the method first runs an identity check.</p> <ul> <li>If the <code>error</code> is of type <code>ClientError</code>, it sends an error response with one of the 4xx status codes.</li> <li>If the <code>error</code> is of type <code>ExternalError</code>, it sends an error response with a <code>424 Failed Dependency</code> status code.</li> <li>If the <code>error</code> is of any other type, it's assumed to an internal server error and a <code>500 Internal Server Error</code> response is sent.</li> </ul> <p> Regardless of the error type, each response includes a detailed description, help message and debugging information in the response body.</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>error</code></td> <td class="type"> <span class="param-type">Error</span> </td> <td class="description last"><p>The error thrown</p></td> </tr> <tr> <td class="name"><code>response</code></td> <td class="type"> <span class="param-type">Express.Response</span> </td> <td class="description last"><p>The response object that will be used to communicate the error back to the client</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line42">line 42</a> </li></ul></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>