Skip to content

Instantly share code, notes, and snippets.

View hboylan's full-sized avatar
😎

Hugh Boylan hboylan

😎
View GitHub Profile
@justmoon
justmoon / custom-error.js
Last active June 26, 2024 09:36 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@Metnew
Metnew / route protected by authentication react-router 4
Created April 15, 2017 15:58
route protected by authentication react-router 4
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {Route, Redirect} from 'react-router'
/**
* Component that protects route from unauthorized users.
* @type {Object}
*/
class RouteAuth extends Component {
constructor(props) {