How to use the verror.VError.hasCauseWithName function in verror

To help you get started, we’ve selected a few verror examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Socialbakers / BakeryJS / src / lib / bakeryjs / ComponentFactory.ts View on Github external
return await f.create(name, queue, parameters).catch((reason) => {
				if (!(reason instanceof Error)) {
					reason = new Error(reason);
				}
				if (VError.hasCauseWithName(reason, 'BoxNotFound')) {
					return;
				}

				throw new VError(
					{
						name: 'FactoryException',
						message: 'ComponentFactory.create(%s) failed.',
						info: {
							factoryBaseURI: f.baseURI,
							requestedBoxName: name,
						},
						cause: reason,
					},
					name
				);
			});