Globalize current-context error messages

This commit is contained in:
Miroslav Bajtoš 2016-08-10 13:37:25 +02:00
parent b087c930ed
commit 59a82a9d5e
3 changed files with 22 additions and 20 deletions

View File

@ -3,6 +3,7 @@
// This file is licensed under the MIT License. // This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT // License text available at https://opensource.org/licenses/MIT
var g = require('strong-globalize')();
var juggler = require('loopback-datasource-juggler'); var juggler = require('loopback-datasource-juggler');
var remoting = require('strong-remoting'); var remoting = require('strong-remoting');
@ -10,23 +11,23 @@ module.exports = function(loopback) {
juggler.getCurrentContext = juggler.getCurrentContext =
remoting.getCurrentContext = remoting.getCurrentContext =
loopback.getCurrentContext = function() { loopback.getCurrentContext = function() {
throw new Error( throw new Error(g.f(
'loopback.getCurrentContext() was removed in version 3.0. See ' + '%s was removed in version 3.0. See %s for more details.',
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + 'loopback.getCurrentContext()',
'for more details.'); 'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
}; };
loopback.runInContext = function(fn) { loopback.runInContext = function(fn) {
throw new Error( throw new Error(g.f(
'loopback.runInContext() was removed in version 3.0. See ' + '%s was removed in version 3.0. See %s for more details.',
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + 'loopback.runInContext()',
'for more details.'); 'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
}; };
loopback.createContext = function(scopeName) { loopback.createContext = function(scopeName) {
throw new Error( throw new Error(g.f(
'loopback.createContext() was removed in version 3.0. See ' + '%s was removed in version 3.0. See %s for more details.',
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + 'loopback.createContext()',
'for more details.'); 'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
}; };
}; };

View File

@ -4,7 +4,8 @@
// License text available at https://opensource.org/licenses/MIT // License text available at https://opensource.org/licenses/MIT
module.exports = function() { module.exports = function() {
throw new Error('loopback#context middleware was removed in version 3.0. ' + throw new Error(g.f(
'See https://docs.strongloop.com/display/APIC/Using%20current%20context ' + '%s middleware was removed in version 3.0. See %s for more details.',
'for more details.'); 'loopback#context',
'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
}; };

View File

@ -9,7 +9,7 @@
var loopback = require('../../lib/loopback'); var loopback = require('../../lib/loopback');
var async = require('async'); var async = require('async');
var deprecate = require('depd')('loopback'); var g = require('strong-globalize')();
/*! /*!
* Export the middleware. * Export the middleware.
@ -41,10 +41,10 @@ function rest() {
var contextOptions = remotingOptions.context; var contextOptions = remotingOptions.context;
if (contextOptions !== undefined && contextOptions !== false) { if (contextOptions !== undefined && contextOptions !== false) {
throw new Error( throw new Error(g.f(
'remoting.context option was removed in version 3.0. See ' + '%s was removed in version 3.0. See %s for more details.',
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + 'remoting.context option',
'for more details.'); 'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
} }
if (app.isAuthEnabled) { if (app.isAuthEnabled) {