-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
6,364 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+83.2 KB
docs/@kabeep/exception/1.0.3/fonts/Montserrat/Montserrat-Regular.woff2
Binary file not shown.
Binary file added
BIN
+18.9 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot
Binary file not shown.
978 changes: 978 additions & 0 deletions
978
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+66.2 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf
Binary file not shown.
Binary file added
BIN
+20.6 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff
Binary file not shown.
Binary file added
BIN
+15.7 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2
Binary file not shown.
Binary file added
BIN
+19.5 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot
Binary file not shown.
1,049 changes: 1,049 additions & 0 deletions
1,049
...@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+67 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf
Binary file not shown.
Binary file added
BIN
+21.2 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff
Binary file not shown.
Binary file added
BIN
+16.2 KB
docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
|
||
<meta charset="utf-8"> | ||
<title>Home - 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/prettify.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> | ||
<script src="scripts/nav.js" defer></script> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
</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="Exception.html">Exception</a><ul class='methods'><li data-type='method'><a href="Exception.html#toString">toString</a></li></ul></li><li><a href="PaletteError.html">PaletteError</a><ul class='methods'><li data-type='method'><a href="PaletteError.html#factory">factory</a></li><li data-type='method'><a href="PaletteError.html#palette">palette</a></li></ul></li><li><a href="PrintError.html">PrintError</a><ul class='methods'><li data-type='method'><a href="PrintError.html#calc">calc</a></li><li data-type='method'><a href="PrintError.html#closing">closing</a></li><li data-type='method'><a href="PrintError.html#divide">divide</a></li><li data-type='method'><a href="PrintError.html#highlight">highlight</a></li><li data-type='method'><a href="PrintError.html#opening">opening</a></li><li data-type='method'><a href="PrintError.html#print">print</a></li></ul></li></ul> | ||
|
||
</nav> | ||
|
||
<div id="main"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="package"> | ||
<h3>@kabeep/exception 1.0.3</h3> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="readme usertext"> | ||
<article><h1>expection</h1> | ||
<div align="center"> | ||
<img src="docs/images/logo-dark.png" alt="logo-dark"> | ||
<p>Exception is a custom error library for Node.js that provides a more flexible and customizable way of handling errors.</p> | ||
<hr> | ||
<p><img src="https://img.shields.io/badge/NodeJS-%E2%89%A514.x-lightseagreen?logo=powershell" alt="nodejs"> | ||
<img src="https://img.shields.io/badge/Version-1.0.0-cornflowerblue" alt="Version"> | ||
<a href="https://codecov.io/gh/kabeep/exception"><img src="https://codecov.io/gh/kabeep/exception/graph/badge.svg?token=KZH2CVD2CD" alt="codecov"></a> | ||
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-slateblue" alt="License"></a></p> | ||
<p>English | <a href="README.zh-CN.md">简体中文</a></p> | ||
</div> | ||
<h2>📖 Introduction</h2> | ||
<blockquote> | ||
<p>Inspired by the work of <a href="https://github.com/sindresorhus">sindresorhus</a>, I decided to open source the most repetitive | ||
encapsulation work I do in CLI development.</p> | ||
</blockquote> | ||
<p>I do not like disorder. Often, unexpected situations arise due to our insufficient consideration. Therefore, I encourage | ||
those around me to engage in more comprehensive error collection work.</p> | ||
<p>The goal of Exception is to transform unexpected occurrences into anticipated outcomes as much as possible.</p> | ||
<p>It allows Error objects to throw exception and stack information in a more aesthetically pleasing and intuitive manner, | ||
and can also serve as Notify to output critical information in workflows.</p> | ||
<div align="center"> | ||
<img src="docs/images/class-inheritance.png" alt="inheritance-tree" width="200"> | ||
<p>class-inheritance</p> | ||
</div> | ||
<h2>⚙️ Installation</h2> | ||
<pre class="prettyprint source lang-bash"><code>npm install @kabeep/exception --save | ||
</code></pre> | ||
<pre class="prettyprint source lang-bash"><code>yarn add @kabeep/exception | ||
</code></pre> | ||
<pre class="prettyprint source lang-bash"><code>pnpm add @kabeep/exception | ||
</code></pre> | ||
<h2>🚀 Usage</h2> | ||
<h3>Plain text or Error object</h3> | ||
<p><a href="example/default.ts">example</a></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// Plain text | ||
throw new Exception('Argument example'); | ||
|
||
// or Error object | ||
throw new Exception(new Error('Argument example')); | ||
</code></pre> | ||
<h3>Using in Asynchronous Contexts</h3> | ||
<p><a href="example/promise.ts">example</a></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
( | ||
async () => { | ||
throw new Exception('Promise example'); | ||
} | ||
)().catch(console.log); | ||
</code></pre> | ||
<h3>Custom Styles</h3> | ||
<p><a href="example/stylish.ts">example</a></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// Use custom style with chalk color, hex and rgb | ||
const stylish = ['51,51,51', 'bg:#f56c6c'] | ||
|
||
console.log( | ||
new Exception('Stylish example', stylish) | ||
); | ||
</code></pre> | ||
<h3>Custom Exceptions</h3> | ||
<p><a href="example/extends.ts">example</a></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// > Warning | ||
class Warning extends Exception { | ||
constructor (message: any) { | ||
super(message, [' 51,51,51 ', 'bg:#e6a23c']); | ||
} | ||
} | ||
|
||
const warn = new Warning('Inherited example'); | ||
// Warning: Inherited example [Without style] | ||
console.log(`${warn}`); | ||
</code></pre> | ||
<h3>Print Key Information</h3> | ||
<p><a href="example/extends.ts">example</a></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// > Info | ||
class Info extends Exception { | ||
constructor (message: any) { | ||
super(message, ['51,51,51', 'bg:#409eff']); | ||
} | ||
|
||
toString () { | ||
return ` ${this.palette(['51,51,51', 'bg:#409eff'])(this.name)} ${this.message}`; | ||
} | ||
} | ||
|
||
const tip = new Info('Inherited example'); | ||
// Without stack | ||
console.log(`${tip}`); | ||
|
||
// > Success | ||
class Success extends Exception { | ||
constructor (message: any) { | ||
super(message, ['51,51,51', 'bg:#67c23a']); | ||
} | ||
|
||
toString () { | ||
return ` ${this.palette(['51,51,51', 'bg:#67c23a'])(this.name)} ${this.message}`; | ||
} | ||
} | ||
|
||
const pass = new Success('Inherited example'); | ||
// Without stack | ||
console.log(pass.toString()); | ||
</code></pre> | ||
<h2>🤝 Contribution</h2> | ||
<p>Contributions via Pull Requests or <a href="https://github.com/kabeep/exception/issues">Issues</a> are welcome.</p> | ||
<h2>📄 License</h2> | ||
<p>This project is licensed under the MIT License. See the <a href="LICENSE">LICENSE</a> file for details.</p></article> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Mon Apr 29 2024 19:18:12 GMT+0800 (中国标准时间) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. | ||
</footer> | ||
|
||
<script>prettyPrint();</script> | ||
<script src="scripts/polyfill.js"></script> | ||
<script src="scripts/linenumber.js"></script> | ||
|
||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.