@simbachain/libsimba-js
Version:
libsimba-js is a library simplifying the use of SIMBAChain APIs. We aim to abstract away the various blockchain concepts, reducing the necessary time needed to get to working code.
269 lines (241 loc) • 12.4 kB
HTML
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../">
<title data-ice="title">src/exceptions.js | libsimba-js</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="Simbachain Blockchain abstraction and interaction library"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="libsimba-js"><meta property="twitter:description" content="Simbachain Blockchain abstraction and interaction library"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./">Home</a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<a href="test.html" data-ice="testLink">Test</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/simbachain/libsimba-js"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~BadMetadataException.html">BadMetadataException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~BaseException.html">BaseException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~GenerateTransactionException.html">GenerateTransactionException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~GetRequestException.html">GetRequestException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~GetTransactionsException.html">GetTransactionsException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~MethodCallValidationMetadataException.html">MethodCallValidationMetadataException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~MissingMetadataException.html">MissingMetadataException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~NotImplementedException.html">NotImplementedException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~NotInBrowserException.html">NotInBrowserException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~PostRequestException.html">PostRequestException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~RetriesExceededException.html">RetriesExceededException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~SigningException.html">SigningException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~SubmitTransactionException.html">SubmitTransactionException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~TransactionStatusCheckException.html">TransactionStatusCheckException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~UserRejectedSigningException.html">UserRejectedSigningException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~WalletLockedException.html">WalletLockedException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/exceptions.js~WalletNotFoundException.html">WalletNotFoundException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getSimbaInstance">getSimbaInstance</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#simba">simba</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/simba/pagedresponse.js~PagedResponse.html">PagedResponse</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/simba/simba.js~Simbachain.html">Simbachain</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/simba/simbabase.js~SimbaBase.html">SimbaBase</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#wallet">wallet</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/wallet/localwallet.js~LocalWallet.html">LocalWallet</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/wallet/pkwallet.js~PKWallet.html">PKWallet</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/wallet/wallet.js~Wallet.html">Wallet</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/exceptions.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/**
* Base exception that all libsimba Exceptions extend
*/
export class BaseException extends Error{
/**
* Base exception that all libsimba Exceptions extend
* @param {string} message - the error message
* @param {Error|string} [cause] - (Optional) wrap an existing error
*/
constructor(message, cause){
super();
this.name = 'BaseException';
if('response' in message){
this.message = message.response.data;
this.cause = cause || message;
}else{
this.message = message;
this.cause = cause;
}
// Maintains proper stack trace for where our error was thrown (only available on V8)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
}
/**
* Thrown when a method that should be implemented is not
*/
export class NotImplementedException extends BaseException{
constructor(...args){
super(...args);
this.name = 'NotImplementedException';
}
}
/**
* Thrown when a method on a class inheriting [SimbaBase]{@link SimbaBase} is called before
* metadata is retrieved.
*/
export class MissingMetadataException extends BaseException{
constructor(...args){
super(...args);
this.name = 'MissingMetadataException';
}
}
/**
* Thrown when metadata doesn't have something it should have
*/
export class BadMetadataException extends BaseException{
constructor(...args){
super(...args);
this.name = 'BadMetadataException';
}
}
/**
* Thrown when a method call isn't valid
*/
export class MethodCallValidationMetadataException extends BaseException{
constructor(...args){
super(...args);
this.name = 'MethodCallValidationMetadataException';
}
}
/**
* Thrown when the server fails to generate the transaction for signing
*/
export class GenerateTransactionException extends BaseException{
constructor(...args){
super(...args);
this.name = 'GenerateTransactionException';
}
}
/**
* Thrown when the server returns an error after submitting a signed transaction
*/
export class SubmitTransactionException extends BaseException{
constructor(...args){
super(...args);
this.name = 'SubmitTransactionException';
}
}
/**
* Thrown when the server returns an error when querying transactions
*/
export class GetRequestException extends BaseException{
constructor(...args){
super(...args);
this.name = 'GetRequestException';
}
}
/**
* Thrown when the server returns an error when querying transactions
*/
export class PostRequestException extends BaseException{
constructor(...args){
super(...args);
this.name = 'PostRequestException';
}
}
/**
* Thrown when the server returns an error when querying transactions
*/
export class GetTransactionsException extends GetRequestException{
constructor(...args){
super(...args);
this.name = 'GetTransactionsException';
}
}
/**
* Thrown when an error occurs checking a transactions status
*/
export class TransactionStatusCheckException extends BaseException{
constructor(...args){
super(...args);
this.name = 'TransactionStatusCheckException';
}
}
/**
* Thrown when there's an error signing a transaction
*/
export class SigningException extends BaseException{
constructor(...args){
super(...args);
this.name = 'SigningException';
}
}
/**
* Thrown when a LocalWallet is created in a non browser environment
*/
export class NotInBrowserException extends BaseException{
constructor(...args){
super(...args);
this.name = 'NotInBrowserException';
}
}
/**
* Thrown when the user rejects the request to sign
*/
export class UserRejectedSigningException extends SigningException{
constructor(...args){
super(...args);
this.name = 'UserRejectedSigningException';
}
}
/**
* Thrown when a method on a class inheriting [SimbaBase]{@link SimbaBase} is called that requires
* a [Wallet]{@link Wallet} to be set, and it isn't.
*/
export class WalletNotFoundException extends SigningException{
constructor(...args){
super(...args);
this.name = 'WalletNotFoundException';
}
}
/**
* Thrown when a method on a class inheriting [SimbaBase]{@link SimbaBase} is called that requires
* a [Wallet]{@link Wallet} to be unlocked, and it isn't.
*/
export class WalletLockedException extends SigningException{
constructor(...args){
super(...args);
this.name = 'WalletLockedException';
}
}
/**
* Thrown when a method call exceeds the max retries
*/
export class RetriesExceededException extends SigningException{
constructor(...args){
super(...args);
this.name = 'RetriesExceededException';
}
}
</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>