Skip to content

Commit

Permalink
feat: Rework
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Sep 17, 2021
1 parent 80b69bc commit 2f6eecb
Show file tree
Hide file tree
Showing 39 changed files with 330 additions and 7,166 deletions.
15 changes: 3 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
# http://editorconfig.org
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
insert_final_newline = ignore

[**.min.js]
indent_style = ignore
insert_final_newline = ignore

[MakeFile]
indent_style = tab

[*.md]
trim_trailing_whitespace = false
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

32 changes: 0 additions & 32 deletions .eslintrc.json

This file was deleted.

70 changes: 0 additions & 70 deletions .github/COMMIT_CONVENTION.md

This file was deleted.

23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

28 changes: 0 additions & 28 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

Binary file removed .github/exceptions.jpg
Binary file not shown.
Binary file added .github/exceptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
36 changes: 0 additions & 36 deletions .github/workflows/lint.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

20 changes: 0 additions & 20 deletions .nycrc

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

39 changes: 0 additions & 39 deletions CONTRIBUTING.md

This file was deleted.

55 changes: 34 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Exceptions 📦
# Exceptions 🛑

> Very simple Exceptions for NodeJS Application
> Very simple Exceptions for NodeJS Applications and other SecJS packages
<p>
<img alt="GitHub language count" src="https://img.shields.io/github/languages/count/secjs/exceptions?style=for-the-badge&logo=appveyor">
Expand All @@ -10,38 +10,51 @@
<img alt="License" src="https://img.shields.io/badge/license-MIT-brightgreen?style=for-the-badge&logo=appveyor">
</p>

The intention behind this repository is to always maintain a viable and simple Exceptions handler to use in any type of `NodeJS Framework`
The intention behind this repository is to always maintain a viable and simple exception creator to use in any type of `NodeJS Framework` and
inside all `SecJS` packages.

<img src=".github/exceptions.jpg" width="200px" align="right" hspace="30px" vspace="100px">
<img src=".github/exceptions.png" width="200px" align="right" hspace="30px" vspace="100px">

## Installation

To use Exceptions in your project, first you need to install `@SecJS/Responses`

```bash
yarn add @SecJS/Responses
npm install @secjs/exceptions
```

Then you can install the Exceptions using;
## Usage

```bash
yarn add @SecJS/Exceptions
### BaseException

> Create your own custom exception extending BaseException methods
```js
class MyCustomException extends BaseException {
constructor(content: string | object = 'My default error', status = 400) {
super(MyCustomException.name, content, status);
}
}

throw new MyCustomException({ error: 'object', use: 'as you want!' })
```

## Usage
### SecJS Exceptions

> You can call the any of Exceptions classes to create a new error
> Or if you prefer, you can use the already built in exception from this package
```js
import {
InternalErrorException,
InvalidArgsExceptions,
import {
BadRequestException,
ForbiddenException,
InternalServerException,
InvalidMethodException,
NotFoundException,
UnauthorizedException
} from '@SecJS/Exceptions'
NotImplementedException,
UnauthorizedException,
UnprocessableEntityException,
UnsupportedMediaException,
} from '@secjs/exceptions'
```

if (1+1 = 3) {
throw new InternalErrorException('1+1 is not 3!!', 'INTERNAL_ERROR')
}
---

```
Made with 🖤 by [jlenon7](https://github.com/jlenon7) :wave:
7 changes: 0 additions & 7 deletions config.json

This file was deleted.

Loading

0 comments on commit 2f6eecb

Please sign in to comment.