Add ValidationError to loopback exports.

Simplify the construction of validation errors in user-land code:

    var error = new loopback.ValidationError(invalidModel);
This commit is contained in:
Miroslav Bajtoš 2014-01-02 10:31:47 +01:00
parent a169c0f428
commit 78f514a003
2 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,7 @@
*/
var loopback = module.exports = require('./lib/loopback');
var datasourceJuggler = require('loopback-datasource-juggler');
/**
* Connectors
@ -17,3 +18,4 @@ loopback.Mail = require('./lib/connectors/mail');
*/
loopback.GeoPoint = require('loopback-datasource-juggler/lib/geo').GeoPoint;
loopback.ValidationError = datasourceJuggler.ValidationError;

View File

@ -1,4 +1,11 @@
describe('loopback', function() {
describe('exports', function() {
it('ValidationError', function() {
expect(loopback.ValidationError).to.be.a('function')
.and.have.property('name', 'ValidationError');
});
});
describe('loopback.createDataSource(options)', function(){
it('Create a data source with a connector.', function() {
var dataSource = loopback.createDataSource({