npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

gulp-errorable

v1.0.0-beta.2

Published

A module which wraps common gulp functions and functionality in order to allow execution of a specified function if a task encounters an error.

Downloads

5

Readme

gulp-errorable

A module providing a custom registry which decorates gulp tasks, to provide the ability to execute error logging functionality in the event that an error occurs. I made this because I wanted to have my verification script, which is basically a local version of my CI script, send me slack messages. However, the time involved in sending the slack message, over the network, meant that gulp terminated the slack messaging function before it could send.

This decorator-based approach allows gulp to wait until a long-running function is finished executing before it terminates. In essence, it allows me to send my slack messages. However, it can really do anything that is needed if an error is found.

Usage Instructions

Import the library and tell gulp to use its registry.

The function to be executed if an error is found, will be awaited, thus it should return a Promise.

import { ErrorableRegistry } from 'gulp-errorable';

const myErrorLoggingFunction = () =>
  new Promise((resolve, _reject) => {
    console.warn('we found an error!');
    resolve();
  });

gulp.registry(new ErrorableRegistry(myErrorLoggingFunction));

Task example:

const lint = seriesPromise({
  name: 'lint',
  tasks: [_lintTs, _checkTypes],
});

const verify = seriesPromise({
  name: 'verify',
  tasks: [
    _registerSlackNotify,
    _gitStatusHumanReview,
    lint,
    test,
    _slackNotify,
  ],
});

export { lint, test };

This is essentially the same way that gulp is normally used.

API

ErrorableRegistry(errorHandlingFunction)

  • ErrorableRegistry(errorHandlingFunction: ErrorHandlingFunction)
    
    // where the type of ErrorHandlingFunction is:
    type ErrorHandlingFunction = () => Promise<any>;

    This is the main custom gulp registry which allows you to provide a function to decorate your tasks, in other words it allows you to do something specific if an error is found in a task. Essentially, you can use this function to do something like make a network request or write to a log file or whatever.


seriesPromise(options)

  • seriesPromise(options:{
      name?: string;
      tasks: Task[];
    })

    Will create a task that wraps series it is essentially equivalent to something like:

    const exampleTask = series(task1, task1);

    The name is optional, but if it is not provided it will be <anonymous>, see Caveats.


seriesPromise(options)

  • parallelPromise(options:{
      name?: string;
      tasks: Task[];
    })

    Will create a task that wraps parallel it is essentially equivalent to something like:

    const exampleTask = parallel(task1, task1);

    The name is optional, but if it is not provided it will be <anonymous>, see Caveats.

Caveats

All tasks must use the gulp Promise-based completion method. This is just a simplifying assumption made, due to the limited amount of safe information given to the module by gulp. To help facilitate this the gulp-errorable provides several wrappers around series and parallel. These essentially "promisify" each of these functions respectively.

Due to this, the names of the tasks using these will not be very friendly, specifically: they will be <anonymous>. However, a name can be provided which fixes this problem, this is optional, and the <anonymous> name can be used if desired, for some reason.

License

MIT Copyright (c) David Piper