How to use error - 10 common examples

To help you get started, we’ve selected a few error 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 rapid7 / le_node / src / node_modules / logger.js View on Github external
if (!_.isObject(opts))
			throw new BadOptionsError(opts, text.optionsNotObj(typeof opts));

		if (_.isUndefined(opts.token))
			throw new BadOptionsError(opts, text.noToken());

		if (!_.isString(opts.token) || !tokenPattern.test(opts.token))
			throw new BadOptionsError(opts, text.invalidToken(opts.token));

		// Log method aliases

		this[$levels] = levelUtil.normalize(opts);

		for (const lvlName of this.levels) {
			if (lvlName in this)
				throw new BadOptionsError(opts, text.levelConflict(lvlName));

			Object.defineProperty(this, lvlName, {
				enumerable: true,
				writable: false,
				value() {
					this.log.apply(this, [lvlName, ...arguments]);
				}
			});
		}

		const bufferSizeConfig = opts.bufferSize || defaults.bufferSize;

		this.ringBuffer = new RingBuffer(bufferSizeConfig);

		// Other permanent options
github rapid7 / le_node / src / node_modules / logger.js View on Github external
constructor(opts) {
		super({
			objectMode: true,
			highWaterMark: 0
		});

		// Sanity checks

		if (_.isUndefined(opts))
			throw new BadOptionsError(opts, text.noOptions());

		if (!_.isObject(opts))
			throw new BadOptionsError(opts, text.optionsNotObj(typeof opts));

		if (_.isUndefined(opts.token))
			throw new BadOptionsError(opts, text.noToken());

		if (!_.isString(opts.token) || !tokenPattern.test(opts.token))
			throw new BadOptionsError(opts, text.invalidToken(opts.token));

		// Log method aliases

		this[$levels] = levelUtil.normalize(opts);

		for (const lvlName of this.levels) {
			if (lvlName in this)
				throw new BadOptionsError(opts, text.levelConflict(lvlName));

			Object.defineProperty(this, lvlName, {
github rapid7 / le_node / src / node_modules / logger.js View on Github external
constructor(opts) {
		super({
			objectMode: true,
			highWaterMark: 0
		});

		// Sanity checks

		if (_.isUndefined(opts))
			throw new BadOptionsError(opts, text.noOptions());

		if (!_.isObject(opts))
			throw new BadOptionsError(opts, text.optionsNotObj(typeof opts));

		if (_.isUndefined(opts.token))
			throw new BadOptionsError(opts, text.noToken());

		if (!_.isString(opts.token) || !tokenPattern.test(opts.token))
			throw new BadOptionsError(opts, text.invalidToken(opts.token));

		// Log method aliases

		this[$levels] = levelUtil.normalize(opts);

		for (const lvlName of this.levels) {
			if (lvlName in this)
github rapid7 / le_node / src / node_modules / logger.js View on Github external
constructor(opts) {
		super({
			objectMode: true,
			highWaterMark: 0
		});

		// Sanity checks

		if (_.isUndefined(opts))
			throw new BadOptionsError(opts, text.noOptions());

		if (!_.isObject(opts))
			throw new BadOptionsError(opts, text.optionsNotObj(typeof opts));

		if (_.isUndefined(opts.token))
			throw new BadOptionsError(opts, text.noToken());

		if (!_.isString(opts.token) || !tokenPattern.test(opts.token))
			throw new BadOptionsError(opts, text.invalidToken(opts.token));

		// Log method aliases

		this[$levels] = levelUtil.normalize(opts);

		for (const lvlName of this.levels) {
			if (lvlName in this)
				throw new BadOptionsError(opts, text.levelConflict(lvlName));

			Object.defineProperty(this, lvlName, {
				enumerable: true,
				writable: false,
				value() {
github dsheiko / puppetry / src / service / io.js View on Github external
export async function readSuite( directory, file ) {

  if ( !directory || typeof directory !== "string" ) {
    throw new InvalidArgumentError( `Directory is empty or not a string` );
  }
  if ( !file || typeof file !== "string" ) {
    throw new InvalidArgumentError( `File is empty or not a string` );
  }

  const filePath = join( directory, file );
  // in case of snippets
  if ( file === SNIPPETS_FILENAME && !fs.existsSync( filePath ) ) {
    log.warn( `Suite file ${filePath} not found.` );
    return null;
  }

  try {
    const text = await readFile( filePath, "utf8" );
    return parseJson( text, filePath );
  } catch ( e ) {
    log.warn( `Renderer process: io.readSuite: ${ e }` );
    throw new IoError( `Suite file ${filePath} cannot be open.
          Please make sure that the file exists and that you have read permission for it` );
github dsheiko / puppetry / src / service / io.js View on Github external
throw new InvalidArgumentError( `File is empty or not a string` );
  }

  const filePath = join( directory, file );
  // in case of snippets
  if ( file === SNIPPETS_FILENAME && !fs.existsSync( filePath ) ) {
    log.warn( `Suite file ${filePath} not found.` );
    return null;
  }

  try {
    const text = await readFile( filePath, "utf8" );
    return parseJson( text, filePath );
  } catch ( e ) {
    log.warn( `Renderer process: io.readSuite: ${ e }` );
    throw new IoError( `Suite file ${filePath} cannot be open.
          Please make sure that the file exists and that you have read permission for it` );
  }
}
github SpagoBILabs / SpagoBI / SpagoBIGeoReportEngine / WebContent / js / src / ext / sbi / locale / de.js View on Github external
Sbi.locale.ln['mf.print.remove'] = 'Seite entfernen';// 'Remove page';
Sbi.locale.ln['mf.print.clearAll'] =  'alle löschen';//'Clear all';
Sbi.locale.ln['mf.print.popupBlocked'] =  'Popup Fenster sind durch Browser blockiert.<br>' +
                         '<br>Benutzen Sie diesen Link zum herrunterladen des Dokuments] = ';
Sbi.locale.ln['mf.print.noPage'] = 'Keine Seite ausgewählt; klicken Sie auf "Seite hinzufügen", um eine hinzuzufügen.';// 'No page selected; click on the "Add page" button to add one.';
Sbi.locale.ln['mf.error'] = 'Fehler';// 'Error';
Sbi.locale.ln['mf.warning'] = 'Warnung';// 'Warning';
Sbi.locale.ln['mf.information'] = 'Informationen';// 'Information';
Sbi.locale.ln['sbi.tools.catalogue.measures.measure.properties'] = 'Eigenschaften der Messung'; //'Measure Properties';
Sbi.locale.ln['sbi.tools.catalogue.measures.dataset.properties'] = 'Datensatz Eigenschaften'; //'Data Set Properties';
Sbi.locale.ln['sbi.tools.catalogue.measures.join.btn'] = 'Auf der Karte zeigen'; //'Show on map';
Sbi.locale.ln['sbi.tools.catalogue.measures.join.tooltip'] = 'Generieren Sie eine thematische Karte mit den ausgewählten Maßnahmen';
Sbi.locale.ln['sbi.tools.catalogue.measures.select.tooltip'] = 'Öffnen Sie den Auswahlrahmen'; //'Open the selection frame';
Sbi.locale.ln['sbi.tools.catalogue.measures.select.btn'] = 'Auswahl'; //'Selection';
Sbi.locale.ln['sbi.tools.catalogue.measures.window.title'] =  'Messungen-Katalog';//'Measures Catalogue';
Sbi.locale.ln['error.mesage.description.measure.join.no.common.dimension'] = 'Ausführen des Joins nicht moeglich, keine gemeinsamen Dimensionen'; //'Impossible to execute the join between measures. The associated datasets haven\'t any dimension in common.';
Sbi.locale.ln['error.mesage.description.measure.join.no.complete.common.dimension'] = 'Ausführen des Joins nicht moeglich, die Datensätze haben keine kompletten Dimensionen gemeinsam'; //'Impossible to execute the join between measures. The associated datasets haven\'t any complete dimension in common.';
Sbi.locale.ln['sbi.tools.catalogue.measures.column.header.alias'] = 'Alias'; //'Alias';
Sbi.locale.ln['sbi.tools.catalogue.measures.column.header.dsName'] = 'Name'; //'Name';
Sbi.locale.ln['sbi.tools.catalogue.measures.column.header.dsLabel'] = 'Etikett'; //'Label';
Sbi.locale.ln['sbi.tools.catalogue.measures.column.header.dsCategory'] = 'Kategorie'; //'Category';
Sbi.locale.ln['sbi.tools.catalogue.measures.column.header.dsType'] = 'Typ'; //'Type';
Sbi.locale.ln['sbi.tools.catalogue.layers.column.header.label'] = 'Etikett'; //'Label';
Sbi.locale.ln['sbi.tools.catalogue.layers.column.header.descr'] = 'Beschreibung'; //'Description';
Sbi.locale.ln['sbi.tools.catalogue.layers.column.header.type'] = 'Typ'; //'Type';
Sbi.locale.ln['sbi.tools.catalogue.layers.column.header.baseLayer'] = 'Basis Layer'; //'Base Layer';
github SpagoBILabs / SpagoBI / SpagoBIProject / web-content / js / src / ext / sbi / locale / en.js View on Github external
//GENERIC
Sbi.locale.ln["error.mesage.description.generic.can.not.responce"]= "Can not send responce to client";
	
//DATASOURCE	
Sbi.locale.ln["error.mesage.description.data.source.cannot.be.null"]= "The label of the data source can not be null";
Sbi.locale.ln["error.mesage.description.data.source.deleting.inuse"] = "Impossible to delete the data source because it is in use";
Sbi.locale.ln["error.mesage.description.data.source.saving.duplicated"]="Impossible to save the data source because there is another one with the same label";

//DATASET
Sbi.locale.ln["error.mesage.description.data.set.cannot.be.null"]= "The label of the data set can not be null";
Sbi.locale.ln["error.mesage.description.data.set.deleting.inuse"] = "Impossible to delete the data set because it is in use";
Sbi.locale.ln["error.mesage.description.data.set.saving.duplicated"]="Impossible to save the data set because there is another one with the same label";
Sbi.locale.ln["error.mesage.description.data.set.parsing.error"]="Impossible to parse file. Check its content and upload it again";

//MEASURES
Sbi.locale.ln["error.mesage.description.measure.join.no.common.dimension"]= "Impossible to execute the join between measures. The associated datasets haven't any dimension in common.";
Sbi.locale.ln["error.mesage.description.measure.join.no.complete.common.dimension"]="Impossible to execute the join between measures. The associated datasets haven't any complete dimension in common.";

//LAYER
Sbi.locale.ln["error.mesage.description.layer.validation.file"]= "The file name is not valid. It can't contain [/,\\]";



//===================================================================
//Sbi.execution.toolbar.SaveDatasetWindow : AD-HOC REPORTING 
//===================================================================
Sbi.locale.ln["sbi.execution.toolbar.savedatasetwindow.fields.datasource"]="Datasource for persistence";


//===================================================================
// SELF SERVICE
//===================================================================
github SpagoBILabs / SpagoBI / SpagoBIProject / web-content / js / src / ext / sbi / locale / de.js View on Github external
//GENERIC
Sbi.locale.ln["error.mesage.description.generic.can.not.responce"]= 'Kann nicht Antwort nicht zu Client senden'; //'Can not send responce to client";
	
//DATASOURCE	
Sbi.locale.ln["error.mesage.description.data.source.cannot.be.null"]= 'Das Etikett der Datenquelle kann nicht null sein'; //'The label of the data source can not be null";
Sbi.locale.ln["error.mesage.description.data.source.deleting.inuse"] = 'Unm\u00ef\u00bf\u0153glich die Datenquelle zu l\u00ef\u00bf\u0153schen, da sie in Gebrauch ist'; //'Impossible to delete the data source because it is in use";
Sbi.locale.ln["error.mesage.description.data.source.saving.duplicated"]='Unm\u00ef\u00bf\u0153glich zu speichern Sie die Datenquelle, weil es ein anderer mit dem gleichen Etikett'; //"Impossible to save the data source because there is another one with the same label";

//DATASET
Sbi.locale.ln["error.mesage.description.data.set.cannot.be.null"]= 'Das Etikett des Datensatzes kann nicht null sein'; //'The label of the data set can not be null";
Sbi.locale.ln["error.mesage.description.data.set.deleting.inuse"] = 'Unm\u00ef\u00bf\u0153glich, den Datensatz l\u00ef\u00bf\u0153schen, da er verwendet wird'; //'Impossible to delete the data set because it is in use";
Sbi.locale.ln["error.mesage.description.data.set.saving.duplicated"]='Unm\u00ef\u00bf\u0153glich, den Datensatz zu speichern, es gibt einen zweiten mit gleichem Etikett'; //"Impossible to save the data set because there is another one with the same label";
Sbi.locale.ln["error.mesage.description.data.set.parsing.error"]='Unm\u00ef\u00bf\u0153glich zu Datei zu analysieren. \u00ef\u00bf\u0153berpr\u00ef\u00bf\u0153fen Sie den Inhalt und laden Sie sie wieder'; //"Impossible to parse file. Check its content and upload it again";

//MEASURES
Sbi.locale.ln["error.mesage.description.measure.join.no.common.dimension"]= 'Unm\u00ef\u00bf\u0153glich den Join zwischen Messungen auszuf\u00ef\u00bf\u0153hren. Die zugeh\u00ef\u00bf\u0153rigen Datens\u00ef\u00bf\u0153tze haben keine Dimension gemeinsam.'; //'Impossible to execute the join between measures. The associated datasets haven't any dimension in common.";
Sbi.locale.ln["error.mesage.description.measure.join.no.complete.common.dimension"]='Unm\u00ef\u00bf\u0153glich den Join zwischen Messungen auszuf\u00ef\u00bf\u0153hren. Die zugeh\u00ef\u00bf\u0153rigen Datens\u00ef\u00bf\u0153tze haben keine komplette Dimension gemeinsam.';//"Impossible to execute the join between measures. The associated datasets haven't any complete dimension in common.";

//LAYER
Sbi.locale.ln["error.mesage.description.layer.validation.file"]= 'Der Dateiname ist nicht g\u00ef\u00bf\u0153ltig. Er darf keine [/ \ \] enthalten'; //"The file name is not valid. It can't contain [/,\\]";



// TODO: provvisori
Sbi.locale.ln['sbi.ds.moreRecent']= 'Neueste';
Sbi.locale.ln['sbi.ds.owner']= 'Autor';
Sbi.locale.ln['sbi.ds.name']= 'Name';
Sbi.locale.ln['sbi.ds.changedon']='Ge\u00ef\u00bf\u0153ndert ';


//===================================================================
//DATASTORE PANEL
github SpagoBILabs / SpagoBI / SpagoBIProject / web-content / js / src / ext / sbi / locale / en.js View on Github external
Sbi.locale.ln["error.mesage.description.generic.can.not.responce"]= "Can not send responce to client";
	
//DATASOURCE	
Sbi.locale.ln["error.mesage.description.data.source.cannot.be.null"]= "The label of the data source can not be null";
Sbi.locale.ln["error.mesage.description.data.source.deleting.inuse"] = "Impossible to delete the data source because it is in use";
Sbi.locale.ln["error.mesage.description.data.source.saving.duplicated"]="Impossible to save the data source because there is another one with the same label";

//DATASET
Sbi.locale.ln["error.mesage.description.data.set.cannot.be.null"]= "The label of the data set can not be null";
Sbi.locale.ln["error.mesage.description.data.set.deleting.inuse"] = "Impossible to delete the data set because it is in use";
Sbi.locale.ln["error.mesage.description.data.set.saving.duplicated"]="Impossible to save the data set because there is another one with the same label";
Sbi.locale.ln["error.mesage.description.data.set.parsing.error"]="Impossible to parse file. Check its content and upload it again";

//MEASURES
Sbi.locale.ln["error.mesage.description.measure.join.no.common.dimension"]= "Impossible to execute the join between measures. The associated datasets haven't any dimension in common.";
Sbi.locale.ln["error.mesage.description.measure.join.no.complete.common.dimension"]="Impossible to execute the join between measures. The associated datasets haven't any complete dimension in common.";

//LAYER
Sbi.locale.ln["error.mesage.description.layer.validation.file"]= "The file name is not valid. It can't contain [/,\\]";



//===================================================================
//Sbi.execution.toolbar.SaveDatasetWindow : AD-HOC REPORTING 
//===================================================================
Sbi.locale.ln["sbi.execution.toolbar.savedatasetwindow.fields.datasource"]="Datasource for persistence";


//===================================================================
// SELF SERVICE
//===================================================================