UNPKG

esrol-errors

Version:

An Errors Class for esrol-server-app. It is used for registering new custom errors with numbers, can get a single or all errors in the registry, has a custom throw error method.

1,403 lines (382 loc) 15 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</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/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="constructor"><span class="type-signature"></span>constructor<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Initialize Register class </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="register.js.html">register.js</a>, <a href="register.js.html#line13">line 13</a> </li></ul></dd> </dl> <h4 class="name" id="constructor"><span class="type-signature"></span>constructor<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Initialize Register class </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="errors.js.html">errors.js</a>, <a href="errors.js.html#line18">line 18</a> </li></ul></dd> </dl> <h4 class="name" id="error"><span class="type-signature"></span>error<span class="signature">(message, code)</span><span class="type-signature"> &rarr; {<a href="global.html#error">error</a>}</span></h4> <div class="description"> custom method for error handling. This method returns the output of _throw from this class. </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">message / text of the error</td> </tr> <tr> <td class="name"><code>code</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">the number that the error has</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="errors.js.html">errors.js</a>, <a href="errors.js.html#line67">line 67</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>_throw</li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#error">error</a></span> </dd> </dl> <h4 class="name" id="getAll"><span class="type-signature"></span>getAll<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> Get all the errors in the registry. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="register.js.html">register.js</a>, <a href="register.js.html#line64">line 64</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> - returns all the errors in the registry </div> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="getAllErrors"><span class="type-signature"></span>getAllErrors<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> Get the whole register with all the errors. This method returns the output of getAll from the Register class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="errors.js.html">errors.js</a>, <a href="errors.js.html#line55">line 55</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="global.html#getAll">getAll</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="getByNumber"><span class="type-signature"></span>getByNumber<span class="signature">(number)</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> Get an error by it's number. This method returns the output of getByNumber from the Register class. </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>number</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">the number of the error</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="errors.js.html">errors.js</a>, <a href="errors.js.html#line42">line 42</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="global.html#getByNumber">getByNumber</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="getByNumber"><span class="type-signature"></span>getByNumber<span class="signature">(number)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> Get an error by it's number. </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>number</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">the number that the error has</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="register.js.html">register.js</a>, <a href="register.js.html#line53">line 53</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> - returns the message of the error </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="registerErrorWithNumber"><span class="type-signature"></span>registerErrorWithNumber<span class="signature">(description, number)</span><span class="type-signature"> &rarr; {true}</span></h4> <div class="description"> Register / set an error with a number. This method returns the output of setErrorWithNumber from the Register class. </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>description</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">description text of the error</td> </tr> <tr> <td class="name"><code>number</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">the number that the error will have</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="errors.js.html">errors.js</a>, <a href="errors.js.html#line27">line 27</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="global.html#setErrorWithNumber">setErrorWithNumber</a></li> </ul> </dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> - if thrown by setErrorWithNumber </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#error">error</a></span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">true</span> </dd> </dl> <h4 class="name" id="setErrorWithNumber"><span class="type-signature"></span>setErrorWithNumber<span class="signature">(description, number)</span><span class="type-signature"> &rarr; {true}</span></h4> <div class="description"> Add an error message and corresponding number to the registry. </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>description</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">description text of the error</td> </tr> <tr> <td class="name"><code>number</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">the number that the error will have</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="register.js.html">register.js</a>, <a href="register.js.html#line22">line 22</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> - throws error when incorrect arguments have been passed </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#error">error</a></span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> - returns true if adding was successful </div> <dl> <dt> Type </dt> <dd> <span class="param-type">true</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Errors.html">Errors</a></li></ul><h3>Global</h3><ul><li><a href="global.html#constructor">constructor</a></li><li><a href="global.html#error">error</a></li><li><a href="global.html#getAll">getAll</a></li><li><a href="global.html#getAllErrors">getAllErrors</a></li><li><a href="global.html#getByNumber">getByNumber</a></li><li><a href="global.html#registerErrorWithNumber">registerErrorWithNumber</a></li><li><a href="global.html#setErrorWithNumber">setErrorWithNumber</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Nov 26 2015 17:49:03 GMT+0200 (FLE Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>