-
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.
docs: add exceptions' API docs generated by TypeDoc
- Loading branch information
Showing
39 changed files
with
2,343 additions
and
89 deletions.
There are no files selected for viewing
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,5 @@ | ||
# We need to ignore this cause this is auto-generated file | ||
pnpm-lock.yaml | ||
|
||
# skip for all auto-enerated docs | ||
docs |
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
"url": "[email protected]:app/libraries.git" | ||
}, | ||
"scripts": { | ||
"docs": "pnpm -r --filter=./packages/** docs", | ||
"preinstall": "npx only-allow pnpm", | ||
"prepare": "husky install", | ||
"build": "pnpm run clean && pnpm -r --filter=./packages/** run build", | ||
|
@@ -42,18 +43,18 @@ | |
"@commitlint/config-conventional": "17.7.0", | ||
"@commitlint/cz-commitlint": "17.7.1", | ||
"@rightcapital/exceptions": "workspace:*", | ||
"@rightcapital/prettier-config": "6.0.1", | ||
"@types/jest": "29.5.5", | ||
"beachball": "2.37.0", | ||
"@rightcapital/prettier-config": "^6.0.1", | ||
"@types/jest": "29.5.4", | ||
"beachball": "2.36.0", | ||
"commitizen": "4.3.0", | ||
"concurrently": "8.2.1", | ||
"eslint": "8.50.0", | ||
"eslint": "8.47.0", | ||
"husky": "8.0.3", | ||
"inquirer": "9.2.11", | ||
"jest": "29.7.0", | ||
"prettier": "3.0.3", | ||
"inquirer": "9.2.10", | ||
"jest": "29.6.3", | ||
"prettier": "3.0.2", | ||
"ts-jest": "29.1.1", | ||
"ts-node": "10.9.1", | ||
"typescript": "5.2.2" | ||
"typescript": "5.1.6" | ||
} | ||
} |
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
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 @@ | ||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. |
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,40 @@ | ||
@rightcapital/exceptions / [Exports](modules.md) | ||
|
||
# `exceptions` | ||
|
||
## Introduction | ||
|
||
This library provides a set of standard Exceptions | ||
|
||
It is inspired by the [PHP's SPL exceptions](https://www.php.net/manual/en/spl.exceptions.php) | ||
|
||
## Installation | ||
|
||
```bash | ||
pnpm add @right/exceptions | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { RuntimeException, LogicException } from '@rightcapital/exceptions'; | ||
|
||
const logicException = new LogicException('A logic exception'); | ||
|
||
try { | ||
// Something | ||
throw new RuntimeException('Crash!', logicException); | ||
} catch (exception) { | ||
if (exception instanceof RuntimeException) { | ||
//.... BlaBlaBla | ||
if (exception.isCausedBy(logicException)) { | ||
console.log( | ||
'Catch you!', | ||
exception.name, | ||
', You are caused by', | ||
exception.cause.name, | ||
); | ||
} | ||
} | ||
} | ||
``` |
137 changes: 137 additions & 0 deletions
137
packages/exceptions/docs/classes/BadFunctionCallException.md
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,137 @@ | ||
[@rightcapital/exceptions](../README.md) / [Exports](../modules.md) / BadFunctionCallException | ||
|
||
# Class: BadFunctionCallException | ||
|
||
Exception thrown if a callback refers to an undefined function or if some arguments are missing. | ||
|
||
## Hierarchy | ||
|
||
- [`LogicException`](LogicException.md) | ||
|
||
↳ **`BadFunctionCallException`** | ||
|
||
↳↳ [`BadMethodCallException`](BadMethodCallException.md) | ||
|
||
## Table of contents | ||
|
||
### Constructors | ||
|
||
- [constructor](BadFunctionCallException.md#constructor) | ||
|
||
### Properties | ||
|
||
- [cause](BadFunctionCallException.md#cause) | ||
- [message](BadFunctionCallException.md#message) | ||
- [name](BadFunctionCallException.md#name) | ||
- [stack](BadFunctionCallException.md#stack) | ||
|
||
### Methods | ||
|
||
- [isCausedBy](BadFunctionCallException.md#iscausedby) | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
• **new BadFunctionCallException**(`message`, `cause?`) | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `message` | `string` | A human-readable description of the error. | | ||
| `cause?` | `any` | The value of cause can be of any type. You should not make assumptions that the error you caught has an Error as its cause, in the same way that you cannot be sure the variable bound in the catch statement is an Error either. The "Providing structured data as the error cause" example below shows a case where a non-error is deliberately provided as the cause. | | ||
|
||
#### Inherited from | ||
|
||
[LogicException](LogicException.md).[constructor](LogicException.md#constructor) | ||
|
||
#### Defined in | ||
|
||
[packages/exceptions/src/exceptions/base.exception.ts:14](https://github.com/RightCapitalHQ/frontend-libraries/blob/98a64d7/packages/exceptions/src/exceptions/base.exception.ts#L14) | ||
|
||
## Properties | ||
|
||
### cause | ||
|
||
• `Optional` **cause**: `any` | ||
|
||
The value of cause can be of any type. You should not make assumptions that the error you caught has an Error as its cause, in the same way that you cannot be sure the variable bound in the catch statement is an Error either. The "Providing structured data as the error cause" example below shows a case where a non-error is deliberately provided as the cause. | ||
|
||
#### Inherited from | ||
|
||
[LogicException](LogicException.md).[cause](LogicException.md#cause) | ||
|
||
#### Defined in | ||
|
||
[packages/exceptions/src/exceptions/base.exception.ts:16](https://github.com/RightCapitalHQ/frontend-libraries/blob/98a64d7/packages/exceptions/src/exceptions/base.exception.ts#L16) | ||
|
||
___ | ||
|
||
### message | ||
|
||
• **message**: `string` | ||
|
||
#### Inherited from | ||
|
||
[LogicException](LogicException.md).[message](LogicException.md#message) | ||
|
||
#### Defined in | ||
|
||
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1068 | ||
|
||
___ | ||
|
||
### name | ||
|
||
• **name**: `string` = `'BadFunctionCallException'` | ||
|
||
#### Overrides | ||
|
||
[LogicException](LogicException.md).[name](LogicException.md#name) | ||
|
||
#### Defined in | ||
|
||
[packages/exceptions/src/exceptions/bad-function-call.exception.ts:8](https://github.com/RightCapitalHQ/frontend-libraries/blob/98a64d7/packages/exceptions/src/exceptions/bad-function-call.exception.ts#L8) | ||
|
||
___ | ||
|
||
### stack | ||
|
||
• `Optional` **stack**: `string` | ||
|
||
#### Inherited from | ||
|
||
[LogicException](LogicException.md).[stack](LogicException.md#stack) | ||
|
||
#### Defined in | ||
|
||
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1069 | ||
|
||
## Methods | ||
|
||
### isCausedBy | ||
|
||
▸ **isCausedBy**(`cause`): `boolean` | ||
|
||
If the Error is caused by the cause we passed in the construction method | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `cause` | `any` | the cause we assume that cause the current exception | | ||
|
||
#### Returns | ||
|
||
`boolean` | ||
|
||
true if the cause we passed is the original cause when the Exception constructed. otherwise, it returns false | ||
|
||
#### Inherited from | ||
|
||
[LogicException](LogicException.md).[isCausedBy](LogicException.md#iscausedby) | ||
|
||
#### Defined in | ||
|
||
[packages/exceptions/src/exceptions/base.exception.ts:27](https://github.com/RightCapitalHQ/frontend-libraries/blob/98a64d7/packages/exceptions/src/exceptions/base.exception.ts#L27) |
Oops, something went wrong.