How to use the moleculer.ServiceSchemaError function in moleculer

To help you get started, we’ve selected a few moleculer 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 moleculerjs / moleculer-db / packages / moleculer-db-adapter-mongoose / src / index.js View on Github external
init(broker, service) {
		this.broker = broker;
		this.service = service;

		if (this.service.schema.model) {
			this.model = this.service.schema.model;
		} else if (this.service.schema.schema) {
			if (!this.service.schema.modelName) {
				throw new ServiceSchemaError("`modelName` is required when `schema` is given in schema of service!");
			}
			this.schema = this.service.schema.schema;
			this.modelName = this.service.schema.modelName;
		}

		if (!this.model && !this.schema) {
			/* istanbul ignore next */
			throw new ServiceSchemaError("Missing `model` or `schema` definition in schema of service!");
		}
	}
github moleculerjs / moleculer-db / packages / moleculer-db-adapter-mongo / src / index.js View on Github external
init(broker, service) {
		this.broker = broker;
		this.service = service;

		if (!this.service.schema.collection) {
			/* istanbul ignore next */
			throw new ServiceSchemaError("Missing `collection` definition in schema of service!");
		}
	}
github moleculerjs / moleculer-db / packages / moleculer-db-adapter-sequelize / src / index.js View on Github external
init(broker, service) {
		this.broker = broker;
		this.service = service;

		if (!this.service.schema.model) {
			/* istanbul ignore next */
			throw new ServiceSchemaError("Missing `model` definition in schema of service!");
		}
	}
github moleculerjs / moleculer-db / packages / moleculer-db-adapter-mongoose / src / index.js View on Github external
this.broker = broker;
		this.service = service;

		if (this.service.schema.model) {
			this.model = this.service.schema.model;
		} else if (this.service.schema.schema) {
			if (!this.service.schema.modelName) {
				throw new ServiceSchemaError("`modelName` is required when `schema` is given in schema of service!");
			}
			this.schema = this.service.schema.schema;
			this.modelName = this.service.schema.modelName;
		}

		if (!this.model && !this.schema) {
			/* istanbul ignore next */
			throw new ServiceSchemaError("Missing `model` or `schema` definition in schema of service!");
		}
	}
github icebob / kantab / backend / mixins / database.js View on Github external
this.logger.error("Connection error!", err);
						if (opts.autoReconnect) {
							setTimeout(() => {
								this.logger.warn("Reconnecting...");
								connecting();
							}, 1000);
						}
					});
				};

				connecting();
			});
		}

		/* istanbul ignore next */
		return Promise.reject(new ServiceSchemaError("Please configure a database adapter!"));
	};
github moleculerjs / moleculer-db / packages / moleculer-db-adapter-couchdb-nano / src / index.js View on Github external
init(broker, service) {
		this.broker = broker;
		this.service = service;
		this.schema = service.schema.schema;
		this.modelName = (service.schema && service.schema.model && service.schema.model.name) || (service.schema && service.schema.modelName) || service.schema.name;
		if (!this.modelName) {
			throw new ServiceSchemaError("Missing `modelName` or `name` definition in schema of service!");
		}
	}