diff --git a/lib/current-context.js b/lib/current-context.js index a4cabc83a..b7df2a8b3 100644 --- a/lib/current-context.js +++ b/lib/current-context.js @@ -3,6 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +var g = require('strong-globalize')(); var juggler = require('loopback-datasource-juggler'); var remoting = require('strong-remoting'); @@ -10,23 +11,23 @@ module.exports = function(loopback) { juggler.getCurrentContext = remoting.getCurrentContext = loopback.getCurrentContext = function() { - throw new Error( - 'loopback.getCurrentContext() was removed in version 3.0. See ' + - 'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + - 'for more details.'); + throw new Error(g.f( + '%s was removed in version 3.0. See %s for more details.', + 'loopback.getCurrentContext()', + 'https://docs.strongloop.com/display/APIC/Using%20current%20context')); }; loopback.runInContext = function(fn) { - throw new Error( - 'loopback.runInContext() was removed in version 3.0. See ' + - 'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + - 'for more details.'); + throw new Error(g.f( + '%s was removed in version 3.0. See %s for more details.', + 'loopback.runInContext()', + 'https://docs.strongloop.com/display/APIC/Using%20current%20context')); }; loopback.createContext = function(scopeName) { - throw new Error( - 'loopback.createContext() was removed in version 3.0. See ' + - 'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + - 'for more details.'); + throw new Error(g.f( + '%s was removed in version 3.0. See %s for more details.', + 'loopback.createContext()', + 'https://docs.strongloop.com/display/APIC/Using%20current%20context')); }; }; diff --git a/server/middleware/context.js b/server/middleware/context.js index e15f6d657..2953252bf 100644 --- a/server/middleware/context.js +++ b/server/middleware/context.js @@ -4,7 +4,8 @@ // License text available at https://opensource.org/licenses/MIT module.exports = function() { - throw new Error('loopback#context middleware was removed in version 3.0. ' + - 'See https://docs.strongloop.com/display/APIC/Using%20current%20context ' + - 'for more details.'); + throw new Error(g.f( + '%s middleware was removed in version 3.0. See %s for more details.', + 'loopback#context', + 'https://docs.strongloop.com/display/APIC/Using%20current%20context')); }; diff --git a/server/middleware/rest.js b/server/middleware/rest.js index c059b5fbd..1ff3d008b 100644 --- a/server/middleware/rest.js +++ b/server/middleware/rest.js @@ -9,7 +9,7 @@ var loopback = require('../../lib/loopback'); var async = require('async'); -var deprecate = require('depd')('loopback'); +var g = require('strong-globalize')(); /*! * Export the middleware. @@ -41,10 +41,10 @@ function rest() { var contextOptions = remotingOptions.context; if (contextOptions !== undefined && contextOptions !== false) { - throw new Error( - 'remoting.context option was removed in version 3.0. See ' + - 'https://docs.strongloop.com/display/APIC/Using%20current%20context ' + - 'for more details.'); + throw new Error(g.f( + '%s was removed in version 3.0. See %s for more details.', + 'remoting.context option', + 'https://docs.strongloop.com/display/APIC/Using%20current%20context')); } if (app.isAuthEnabled) {