-
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
34 changed files
with
6,554 additions
and
0 deletions.
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.2.3/fonts/Montserrat/Montserrat-Regular.woff2
Binary file not shown.
Binary file added
BIN
+18.9 KB
docs/@kabeep/exception/1.2.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot
Binary file not shown.
978 changes: 978 additions & 0 deletions
978
docs/@kabeep/exception/1.2.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.2.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf
Binary file not shown.
Binary file added
BIN
+20.6 KB
docs/@kabeep/exception/1.2.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff
Binary file not shown.
Binary file added
BIN
+15.7 KB
docs/@kabeep/exception/1.2.3/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2
Binary file not shown.
Binary file added
BIN
+19.5 KB
docs/@kabeep/exception/1.2.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.2.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.2.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf
Binary file not shown.
Binary file added
BIN
+21.2 KB
docs/@kabeep/exception/1.2.3/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff
Binary file not shown.
Binary file added
BIN
+16.2 KB
docs/@kabeep/exception/1.2.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,250 @@ | ||
<!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#info">info</a></li><li data-type='method'><a href="PaletteError.html#padding">padding</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.2.3</h3> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="readme usertext"> | ||
<article><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><a href="https://nodejs.org/docs/latest/api/"><img src="https://img.shields.io/node/v/%40kabeep%2Fexception?color=lightseagreen" alt="NodeJS"></a> | ||
<a href="LICENSE"><img src="https://img.shields.io/github/license/kabeep/exception?color=slateblue" alt="License"></a> | ||
<a href="https://www.npmjs.com/package/@kabeep/exception"><img src="https://img.shields.io/npm/d18m/%40kabeep%2Fexception?color=cornflowerblue" alt="NPM"></a> | ||
<a href="https://codecov.io/gh/kabeep/exception"><img src="https://img.shields.io/codecov/c/github/kabeep/exception?logo=codecov&color=mediumvioletred" alt="Codecov"></a> | ||
<a href="https://app.codacy.com/gh/kabeep/exception/dashboard"><img src="https://img.shields.io/codacy/grade/ec3b39338b4648de99fc51366e5bcdaa?logo=codacy&logoColor=dodgerblue&color=dodgerblue" alt="Codacy"></a> | ||
<a href="https://dl.circleci.com/status-badge/redirect/circleci/Qh23T2Zgw4Fy4V8uvKaymp/JeKeBwNTskLytiuiJPdQ2R/tree/master"><img src="https://dl.circleci.com/status-badge/img/circleci/Qh23T2Zgw4Fy4V8uvKaymp/JeKeBwNTskLytiuiJPdQ2R/tree/master.svg?style=shield" alt="CircleCI"></a></p> | ||
<p>English | <a href="README.zh-CN.md">简体中文</a></p> | ||
<p><img src="https://repobeats.axiom.co/api/embed/92224457b32c02414aa34c21a923f17f95019cd4.svg" alt="Alt" title="Repobeats analytics image"></p> | ||
<img src="docs/images/Inheritance-and-prototype-chain.png" alt="inheritance-tree"> | ||
<p>Inheritance and the prototype chain</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> | ||
<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> | ||
<p><img src="docs/images/Plain-text-or-Error-object.png" alt="Plain-text-or-Error-object"></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> | ||
<p><img src="docs/images/Using-in-Asynchronous-Contexts.png" alt="Using-in-Asynchronous-Contexts"></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> | ||
<p><img src="docs/images/Custom-Styles.png" alt="Custom-Styles"></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// Use custom style with hex or 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> | ||
<p><img src="docs/images/Custom-Exceptions.png" alt="Custom-Exceptions"></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// > Warning | ||
class Warning extends Exception { | ||
constructor (message: string | Error) { | ||
super(message, '( 51 ,51, 51 ).bg#e6a23c'); | ||
} | ||
} | ||
|
||
const warn = new Warning('Inherited example'); | ||
// Warning: Inherited example [Without style] | ||
console.log(`${warn}`); | ||
console.log(warn); | ||
</code></pre> | ||
<h3>Print Key Information</h3> | ||
<p><a href="example/extends.ts">example</a></p> | ||
<p><img src="docs/images/Print-Key-Information.png" alt="Print-Key-Information"></p> | ||
<pre class="prettyprint source lang-javascript"><code>import Exception from '@kabeep/exception'; | ||
|
||
// > Info | ||
const infoStyle = '(51,51,51).bg#409eff'; | ||
|
||
class Info extends Exception { | ||
constructor (message) { | ||
super(message, infoStyle); | ||
} | ||
|
||
toString () { | ||
return this.info(styles); | ||
} | ||
} | ||
|
||
const tip = new Info('Inherited example'); | ||
// Without stack | ||
console.log(`${tip}`); | ||
|
||
// > Success | ||
const successStyle = '(51,51,51).bg#67c23a'; | ||
|
||
class Success extends Exception { | ||
constructor (message) { | ||
super(message, successStyle); | ||
} | ||
|
||
toString () { | ||
return this.info(styles); | ||
} | ||
} | ||
|
||
const pass = new Success('Inherited example'); | ||
// Without stack | ||
console.log(pass.toString()); | ||
</code></pre> | ||
<h2>🎨 Supported styles</h2> | ||
<ul> | ||
<li><a href="https://github.com/chalk/chalk#modifiers">Modifiers</a></li> | ||
</ul> | ||
<pre class="prettyprint source lang-json"><code>"dim.italic.underline" | ||
</code></pre> | ||
<ul> | ||
<li><a href="https://github.com/chalk/chalk#colors">Colors</a></li> | ||
</ul> | ||
<pre class="prettyprint source lang-json"><code>"magenta.cyan" | ||
</code></pre> | ||
<ul> | ||
<li><a href="https://github.com/chalk/chalk#background-colors">Background colors</a></li> | ||
</ul> | ||
<pre class="prettyprint source lang-json"><code>"bgMagenta.bgCyan" | ||
</code></pre> | ||
<ul> | ||
<li><a href="https://en.wikipedia.org/wiki/Web_colors#Hex_triplet">Hex triplet</a></li> | ||
</ul> | ||
<pre class="prettyprint source lang-json"><code>"#fff.bg#333333" | ||
</code></pre> | ||
<ul> | ||
<li><a href="https://en.wikipedia.org/wiki/RGB_color_model">RGB model</a></li> | ||
</ul> | ||
<pre class="prettyprint source lang-json"><code>"(51,51,51).bg(24,124,255)" | ||
</code></pre> | ||
<ul> | ||
<li><a href="https://www.w3.org/wiki/CSS/Properties/color/keywords">CSS keywords</a></li> | ||
</ul> | ||
<pre class="prettyprint source lang-json"><code>"cyan.bgDarkblue" | ||
</code></pre> | ||
<h2>🔗 Related</h2> | ||
<ul> | ||
<li><a href="https://github.com/chalk/chalk">chalk</a> - Terminal string styling done right</li> | ||
<li><a href="https://github.com/LitoMore/chalk-pipe">chalk-pipe</a> - Create chalk style schemes with simpler style strings</li> | ||
</ul> | ||
<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 Sun May 05 2024 05:26:16 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.