import * as _ from 'lodash' ; export class Logger { static parseDatabaseError ( err , category ) { if ( _ . includes ( err . message , 'violates foreign key constraint' ) ) { return `Items that depend on that ${ category } still exist. Removal aborted.` ; } if ( _ . includes ( err . message , 'duplicate key value violates unique constraint' ) ) { return `An item with a duplicate chunk of unique data exists. Aborted.` ; } return 'Unknown error.' ; } static browserError ( err ) { return { message : err } ; } static error ( tag , msg ) { const sentMessage = new Error ( `[${ tag }] ${ msg }` ) ; console . error ( sentMessage ) ; return sentMessage . message ; } static info ( tag , msg ) { console . log ( `[${ tag }] ${ msg }` ) ; } }