@magic.batua/utility
Version:
The Utility module manages all the utility bills functionalities of the Magic Batua platform.
89 lines (68 loc) • 3.82 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Source/UtilityError.js - 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="Electricity.html">Electricity</a><ul class='methods'><li data-type='method'><a href="Electricity.html#.CheckStatus">CheckStatus</a></li><li data-type='method'><a href="Electricity.html#.GetProviders">GetProviders</a></li><li data-type='method'><a href="Electricity.html#Pay">Pay</a></li><li data-type='method'><a href="Electricity.html#Validate">Validate</a></li></ul></li><li><a href="Gas.html">Gas</a><ul class='methods'><li data-type='method'><a href="Gas.html#.CheckStatus">CheckStatus</a></li><li data-type='method'><a href="Gas.html#.GetProviders">GetProviders</a></li><li data-type='method'><a href="Gas.html#Pay">Pay</a></li></ul></li><li><a href="Insurance.html">Insurance</a><ul class='methods'><li data-type='method'><a href="Insurance.html#.CheckStatus">CheckStatus</a></li><li data-type='method'><a href="Insurance.html#.GetProviders">GetProviders</a></li><li data-type='method'><a href="Insurance.html#Pay">Pay</a></li></ul></li><li><a href="Provider.html">Provider</a><ul class='methods'><li data-type='method'><a href="Provider.html#.InitList">InitList</a></li><li data-type='method'><a href="Provider.html#.WithCode">WithCode</a></li></ul></li><li><a href="UtilityBill.html">UtilityBill</a></li></ul><h3>Modules</h3><ul><li><a href="module-UtilityError.html">UtilityError</a><ul class='methods'><li data-type='method'><a href="module-UtilityError.html#~Check">Check</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">Source/UtilityError.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
/**
* @module UtilityError
* @overview Defines methods that parse Rocket in Pocket response and look for errors.
*
* @author Animesh Mishra <hello@animesh.ltd>
* @copyright © Animesh Ltd. All Rights Reserved.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const error_1 = require("@magic.batua/error");
/** @exports UtilityError */
exports.description = "Defines method that parse Rocket in Pocket response and look for errors.";
/**
* Checks whether the given Rocket in Pocket API `response` has any errors. If not, returns
* `null`, otherwise returns an `ExternalError` describing the failure.
*
* @param {any} response Response sent by Rocket in Pocket API
*
* @returns {ExternalError | null}
*/
function Check(response) {
if (response.message) {
return new error_1.ExternalError(response.message, "Rocket in Pocket", "RIP error code: " + response.errorCode);
}
else {
return null;
}
}
exports.Check = Check;
//# sourceMappingURL=UtilityError.js.map</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated at Tue Mar 20 2018 03:29:29 GMT+0530 (IST)
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>