mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
suppressConnectErrors now prints a warning
Renames suppressExpressErrors to _suppressExpressErrors as it should not be part of the public API, except for testing
This commit is contained in:
@@ -467,7 +467,7 @@ if (Meteor.isServer) {
|
||||
function (test, expect) {
|
||||
// Suppress error printing for this test (and for any other code that sets
|
||||
// the x-suppress-error header).
|
||||
WebApp.suppressExpressErrors();
|
||||
WebApp._suppressExpressErrors();
|
||||
|
||||
function do_test (path, code, match) {
|
||||
const prefix = Meteor.isModern
|
||||
|
||||
8
packages/webapp/webapp.d.ts
vendored
8
packages/webapp/webapp.d.ts
vendored
@@ -36,10 +36,14 @@ export declare module WebApp {
|
||||
var httpServer: http.Server;
|
||||
var expressApp: express.Application;
|
||||
/**
|
||||
* @deprecated use suppressExpressErrors instead
|
||||
* Should be used only for testing
|
||||
* @deprecated use _suppressExpressErrors instead
|
||||
*/
|
||||
function suppressConnectErrors(): void;
|
||||
function suppressExpressErrors(): void;
|
||||
/**
|
||||
* Should be used only for testing
|
||||
*/
|
||||
function _suppressExpressErrors(): void;
|
||||
function onListening(callback: Function): void;
|
||||
|
||||
type RuntimeConfigHookCallback = (options: {
|
||||
|
||||
@@ -1349,6 +1349,8 @@ async function runWebAppServer() {
|
||||
suppressExpressErrors = true;
|
||||
};
|
||||
|
||||
let warnedAboutConnectUsage = false;
|
||||
|
||||
// start up app
|
||||
_.extend(WebApp, {
|
||||
connectHandlers: packageAndAppHandlers,
|
||||
@@ -1358,8 +1360,14 @@ async function runWebAppServer() {
|
||||
httpServer: httpServer,
|
||||
expressApp: app,
|
||||
// For testing.
|
||||
suppressConnectErrors: suppressErrors,
|
||||
suppressExpressErrors: suppressErrors,
|
||||
suppressConnectErrors: () => {
|
||||
if (! warnedAboutConnectUsage) {
|
||||
Meteor._debug("WebApp.suppressConnectErrors has been renamed to Meteor._suppressExpressErrors and it should be used only in tests.");
|
||||
warnedAboutConnectUsage = true;
|
||||
}
|
||||
suppressErrors();
|
||||
},
|
||||
_suppressExpressErrors: suppressErrors,
|
||||
onListening: function(f) {
|
||||
if (onListeningCallbacks) onListeningCallbacks.push(f);
|
||||
else f();
|
||||
|
||||
Reference in New Issue
Block a user