replaced throw 'string' with throw new Error('message')