Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gastonpereyra/press-f
When an Error happens, press "f" to pay respect
https://github.com/gastonpereyra/press-f
error funny memes
Last synced: 8 days ago
JSON representation
When an Error happens, press "f" to pay respect
- Host: GitHub
- URL: https://github.com/gastonpereyra/press-f
- Owner: gastonpereyra
- License: mit
- Created: 2020-08-21T01:05:00.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-11T21:59:06.000Z (about 3 years ago)
- Last Synced: 2024-10-05T09:17:59.081Z (about 1 month ago)
- Topics: error, funny, memes
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/press-f
- Size: 67.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Press F
![Build Status](https://github.com/gastonpereyra/press-f/workflows/Build%20Status/badge.svg)
[![Coverage Status](https://img.shields.io/coveralls/github/gastonpereyra/press-f/master.svg)](https://coveralls.io/r/gastonpereyra/press-f?branch=master)![npmF](https://user-images.githubusercontent.com/39351850/90847511-113fe180-e341-11ea-9676-12964f43a55a.png)
## Description
When an Error happens, press "f" to pay respect. A funny replace to Error class.## Installation
```
npm i press-f
```## Usage
### new F(message)
Replace of `new Error('some message')`
```js
const F = require('press-f');if(shouldNotHappen())
throw new F('This should not happen because i don\'t like it');/*
output:
throw new F(This should not happen because i don\'t like it');
^Press F: This should not happen because i don't like it
at ...
*/
```### new F()
Replace of `new Error()`
```js
const F = require('press-f');if(shouldNotHappen())
throw new F();/*
output:
throw new F();
^Press F: Pay Respect
at ...
*/
```### new F(message, name)
Replace of `new Error(message)` but change Error name for a custom one, if `name` is *string*
```js
const F = require('press-f');if(shouldNotHappen())
throw new F('I don\'t care', 'This is not an Error');/*
output:
throw new F();
^This is not an Error: I don't care
at ...
*/
```## Utils
### previousError
If `F` create from another Error can get this one using the getter `previousError`
```js
const F = require('press-f');try {
shouldNotHappen();
} catch (error) {
throw new F(error, 'Custom');
}/*
output:
throw new F(error, 'Custom');
^Custom: Error: 'Old Error'
at ...name: 'Custom',
previousError: Error: 'Old Error'
at ...
*/
```