Tabnine Logo For Javascript
Promise.catch
Code IndexAdd Tabnine to your IDE (free)

How to use
catch
function
in
Promise

Best JavaScript code snippets using builtins.Promise.catch(Showing top 15 results out of 63,135)

origin: cube-js/cube.js

export function unregister() {
 if ('serviceWorker' in navigator) {
  navigator.serviceWorker.ready
   .then(registration => {
    registration.unregister();
   })
   .catch(error => {
    console.error(error.message);
   });
 }
}
origin: facundoolano/google-play-scraper

it('should throw and error if the given collection exists but have no clusters', () => {
  const collection = gplay.collection.NEW_FREE;

  return gplay.list({
   collection,
   category: gplay.category.BUSINESS,
   num: 100
  })
   .catch((error) => {
    assert.equal(error.message, `The collection ${collection} is invalid for the given category, top apps or new apps`);
   });
 });
origin: Flood-UI/flood

sendDefferedMethodCall() {
  if (this.pendingRequests.length > 0) {
   this.isRequestPending = true;

   const nextRequest = this.pendingRequests.shift();

   this.sendMethodCall(nextRequest.methodName, nextRequest.parameters)
    .then(nextRequest.resolve)
    .catch(nextRequest.reject);
  }
 }
origin: moleculerjs/moleculer

it("should call client.getBuffer with key & return with data1", () => {
    let p = cacher.get(key);
    expect(cacher.client.getBuffer).toHaveBeenCalledTimes(1);
    expect(cacher.client.getBuffer).toHaveBeenCalledWith(prefix + key);
    return p.catch(protectReject).then((d) => {
      expect(d).toEqual(data1);
    });
  });
origin: laurent22/joplin

main().catch((error) => {
  console.error('Fatal error');
  console.error(error);
  process.exit(1);
});
origin: facundoolano/google-play-scraper

it('should validate the age range', () => {
  return gplay.list({
   category: gplay.category.GAME_ACTION,
   collection: gplay.collection.TOP_FREE,
   age: 'elderly'
  })
   .then(assert.fail)
   .catch((e) => assert.equal(e.message, 'Invalid age range elderly'));
 });
origin: moleculerjs/moleculer

it("should call client.scanStream", () => {
    return cacher.clean()
      .catch(protectReject)
      .then(() => {
        expect(cacher.client.scanStream).toHaveBeenCalledTimes(1);
        expect(cacher.client.scanStream).toHaveBeenCalledWith({
          match: "MOL-uat-*",
          count: 100
        });
      });

  });
origin: feross/thanks

init()
 .catch(function (err) {
  const message = `Error: ${err.message}\n`

  if (spinner) spinner.fail(message)
  else console.error(message)

  console.error(
   chalk`{cyan Found a bug?} Open an issue at {magenta https://github.com/feross/thanks}\n`
  )
  console.error(err.stack)
  process.exitCode = 1
 })
origin: ks888/LambStatus

release(process.argv[2] !== '--force').then(() => {
 console.log('released lambda functions')
}).catch((error) => {
 console.log(error.message)
 console.log(error.stack)
})
origin: facundoolano/google-play-scraper

it('should validate the category', () => {
  return gplay.list({
   category: 'wrong',
   collection: gplay.collection.TOP_FREE
  })
   .then(assert.fail)
   .catch((e) => assert.equal(e.message, 'Invalid category wrong'));
 });
origin: GoogleCloudPlatform/nodejs-docs-samples

createPool()
 .then(async (pool) => {
  await ensureSchema(pool);
  return pool;
 })
 .catch((err) => {
  logger.error(err);
  process.exit(1);
 })
origin: moleculerjs/moleculer

it("should call 'delta' action", () => {
    flowHooks = [];
    return broker.call("main.delta").catch(protectReject).then(res => {
      expect(res).toBe("From mixin2L1");
      expect(flowHooks).toEqual([
        "mixinL2-before-all",
        "mixinL2-before-all",
        "main-before-all",
        "mixin1L1-after-all"
      ]);
    });
  });
origin: laurent22/joplin

main().catch((error) => {
  console.error('Fatal error');
  console.error(error);
  console.error('');
  console.error('If the app cannot auto-detect the previous tag name, specify it using --changelog-from TAG_NAME');
  process.exit(1);
});
origin: laurent22/joplin

main().catch((error) => {
  console.error('Fatal error');
  console.error(error);
  process.exit(1);
});
origin: ks888/LambStatus

release(process.argv[2] !== '--force').then(() => {
 console.log('released lambda functions')
}).catch((error) => {
 console.log(error.message)
 console.log(error.stack)
})
builtins(MDN)Promisecatch

JSDoc

Attaches a callback for only the rejection of the Promise.

Most used builtins functions

  • Console.log
  • Console.error
  • Promise.then
    Attaches callbacks for the resolution and/or rejection of the Promise.
  • Promise.catch
    Attaches a callback for only the rejection of the Promise.
  • Array.push
    Appends new elements to an array, and returns the new length of the array.
  • Array.length,
  • Array.map,
  • String.indexOf,
  • fetch,
  • Window.location,
  • Window.addEventListener,
  • ObjectConstructor.keys,
  • Array.forEach,
  • Location.reload,
  • Response.status,
  • Navigator.serviceWorker,
  • ServiceWorkerContainer.register,
  • ServiceWorkerRegistration.installing,
  • ServiceWorkerContainer.controller

Popular in JavaScript

  • mongodb
    The official MongoDB driver for Node.js
  • request
    Simplified HTTP request client.
  • postcss
  • chalk
    Terminal string styling done right
  • glob
    a little globber
  • mocha
    simple, flexible, fun test framework
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • colors
    get colors in your node.js console
  • async
    Higher-order functions and common patterns for asynchronous code
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now