Skip to content

Commit 080b035

Browse files
committed
Bump version 1.0.3
1 parent 112861a commit 080b035

35 files changed

+6364
-1
lines changed

docs/@kabeep/exception/1.0.3/Exception.html

+408
Large diffs are not rendered by default.

docs/@kabeep/exception/1.0.3/PaletteError.html

+672
Large diffs are not rendered by default.

docs/@kabeep/exception/1.0.3/PrintError.html

+1,315
Large diffs are not rendered by default.
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 not shown.

docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg

+978
Loading

docs/@kabeep/exception/1.0.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg

+1,049
Loading
+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
5+
<meta charset="utf-8">
6+
<title>Home - Documentation</title>
7+
8+
9+
<script src="scripts/prettify/prettify.js"></script>
10+
<script src="scripts/prettify/lang-css.js"></script>
11+
<!--[if lt IE 9]>
12+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13+
<![endif]-->
14+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
15+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16+
<script src="scripts/nav.js" defer></script>
17+
18+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
19+
</head>
20+
<body>
21+
22+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
23+
<label for="nav-trigger" class="navicon-button x">
24+
<div class="navicon"></div>
25+
</label>
26+
27+
<label for="nav-trigger" class="overlay"></label>
28+
29+
<nav >
30+
31+
32+
<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>
33+
34+
</nav>
35+
36+
<div id="main">
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
<section class="package">
47+
<h3>@kabeep/exception 1.0.3</h3>
48+
</section>
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
<section class="readme usertext">
63+
<article><h1>expection</h1>
64+
<div align="center">
65+
<img src="docs/images/logo-dark.png" alt="logo-dark">
66+
<p>Exception is a custom error library for Node.js that provides a more flexible and customizable way of handling errors.</p>
67+
<hr>
68+
<p><img src="https://img.shields.io/badge/NodeJS-%E2%89%A514.x-lightseagreen?logo=powershell" alt="nodejs">
69+
<img src="https://img.shields.io/badge/Version-1.0.0-cornflowerblue" alt="Version">
70+
<a href="https://codecov.io/gh/kabeep/exception"><img src="https://codecov.io/gh/kabeep/exception/graph/badge.svg?token=KZH2CVD2CD" alt="codecov"></a>
71+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-slateblue" alt="License"></a></p>
72+
<p>English | <a href="README.zh-CN.md">简体中文</a></p>
73+
</div>
74+
<h2>📖 Introduction</h2>
75+
<blockquote>
76+
<p>Inspired by the work of <a href="https://github.com/sindresorhus">sindresorhus</a>, I decided to open source the most repetitive
77+
encapsulation work I do in CLI development.</p>
78+
</blockquote>
79+
<p>I do not like disorder. Often, unexpected situations arise due to our insufficient consideration. Therefore, I encourage
80+
those around me to engage in more comprehensive error collection work.</p>
81+
<p>The goal of Exception is to transform unexpected occurrences into anticipated outcomes as much as possible.</p>
82+
<p>It allows Error objects to throw exception and stack information in a more aesthetically pleasing and intuitive manner,
83+
and can also serve as Notify to output critical information in workflows.</p>
84+
<div align="center">
85+
<img src="docs/images/class-inheritance.png" alt="inheritance-tree" width="200">
86+
<p>class-inheritance</p>
87+
</div>
88+
<h2>⚙️ Installation</h2>
89+
<pre class="prettyprint source lang-bash"><code>npm install @kabeep/exception --save
90+
</code></pre>
91+
<pre class="prettyprint source lang-bash"><code>yarn add @kabeep/exception
92+
</code></pre>
93+
<pre class="prettyprint source lang-bash"><code>pnpm add @kabeep/exception
94+
</code></pre>
95+
<h2>🚀 Usage</h2>
96+
<h3>Plain text or Error object</h3>
97+
<p><a href="example/default.ts">example</a></p>
98+
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception';
99+
100+
// Plain text
101+
throw new Exception('Argument example');
102+
103+
// or Error object
104+
throw new Exception(new Error('Argument example'));
105+
</code></pre>
106+
<h3>Using in Asynchronous Contexts</h3>
107+
<p><a href="example/promise.ts">example</a></p>
108+
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception';
109+
110+
(
111+
async () => {
112+
throw new Exception('Promise example');
113+
}
114+
)().catch(console.log);
115+
</code></pre>
116+
<h3>Custom Styles</h3>
117+
<p><a href="example/stylish.ts">example</a></p>
118+
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception';
119+
120+
// Use custom style with chalk color, hex and rgb
121+
const stylish = ['51,51,51', 'bg:#f56c6c']
122+
123+
console.log(
124+
new Exception('Stylish example', stylish)
125+
);
126+
</code></pre>
127+
<h3>Custom Exceptions</h3>
128+
<p><a href="example/extends.ts">example</a></p>
129+
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception';
130+
131+
// > Warning
132+
class Warning extends Exception {
133+
constructor (message: any) {
134+
super(message, [' 51,51,51 ', 'bg:#e6a23c']);
135+
}
136+
}
137+
138+
const warn = new Warning('Inherited example');
139+
// Warning: Inherited example [Without style]
140+
console.log(`${warn}`);
141+
</code></pre>
142+
<h3>Print Key Information</h3>
143+
<p><a href="example/extends.ts">example</a></p>
144+
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception';
145+
146+
// > Info
147+
class Info extends Exception {
148+
constructor (message: any) {
149+
super(message, ['51,51,51', 'bg:#409eff']);
150+
}
151+
152+
toString () {
153+
return ` ${this.palette(['51,51,51', 'bg:#409eff'])(this.name)} ${this.message}`;
154+
}
155+
}
156+
157+
const tip = new Info('Inherited example');
158+
// Without stack
159+
console.log(`${tip}`);
160+
161+
// > Success
162+
class Success extends Exception {
163+
constructor (message: any) {
164+
super(message, ['51,51,51', 'bg:#67c23a']);
165+
}
166+
167+
toString () {
168+
return ` ${this.palette(['51,51,51', 'bg:#67c23a'])(this.name)} ${this.message}`;
169+
}
170+
}
171+
172+
const pass = new Success('Inherited example');
173+
// Without stack
174+
console.log(pass.toString());
175+
</code></pre>
176+
<h2>🤝 Contribution</h2>
177+
<p>Contributions via Pull Requests or <a href="https://github.com/kabeep/exception/issues">Issues</a> are welcome.</p>
178+
<h2>📄 License</h2>
179+
<p>This project is licensed under the MIT License. See the <a href="LICENSE">LICENSE</a> file for details.</p></article>
180+
</section>
181+
182+
183+
184+
185+
186+
187+
188+
189+
</div>
190+
191+
<br class="clear">
192+
193+
<footer>
194+
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.
195+
</footer>
196+
197+
<script>prettyPrint();</script>
198+
<script src="scripts/polyfill.js"></script>
199+
<script src="scripts/linenumber.js"></script>
200+
201+
202+
203+
</body>
204+
</html>

0 commit comments

Comments
 (0)