Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

press-f

gastonpereyra1.5kMIT1.1.1

A funny replace to Error class

error, memes, funny

readme

Press F

Build Status Coverage Status

npmF

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')

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()

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

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

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 ...
*/

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[1.1.1] 2021-09-11

Updated

  • Dependencies

[1.1.0] 2020-09-06

Added

  • previousError field to keep tracking erros

[1.0.0] 2020-08-20

Added

  • Press-F class
  • Custom Error Names