"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getText = exports.MESSAGE = void 0;
exports.MESSAGE = {
destConnectionTerminated: 'Failed to perform a request to the resource at {url} because of an error.\n{message}',
cantResolveUrl: 'Failed to find a DNS-record for the resource at {url}.',
cantEstablishTunnelingConnection: 'Cannot establish a tunnel to {url}. The proxy may be unresponsive or unable to handle HTTPS connections.',
cantEstablishProxyConnection: 'Failed to connect to the proxy host at {url}.',
cantAuthorizeToProxy: 'Failed to authorize to the proxy at {url}.',
destRequestTimeout: 'Failed to complete a request to {url} within the timeout period. The problem may be related to local machine\'s network or firewall settings, server outage, or network problems that make the server inaccessible.',
cantReadFile: 'Failed to read a file at {url} because of the error:\n\n{message}',
nodeError: {
'HPE_HEADER_OVERFLOW': 'The request header\'s size is {headerSize} bytes which exceeds the set limit.\nIt causes an internal Node.js error on parsing this header.\nTo fix the problem, you need to add the \'--max-http-header-size=...\' flag to the \'NODE_OPTIONS\' environment variable:\n\nmacOS, Linux (bash, zsh)\nexport NODE_OPTIONS=\'--max-http-header-size={recommendedMaxHeaderSize}\'\n\nWindows (powershell)\n$env:NODE_OPTIONS=\'--max-http-header-size={recommendedMaxHeaderSize}\'\n\nWindows (cmd)\nset NODE_OPTIONS="--max-http-header-size={recommendedMaxHeaderSize}"\n\nand then start your tests.',
'HPE_INVALID_HEADER_TOKEN': 'The request contains a header that doesn\'t comply with the specification https://tools.ietf.org/html/rfc7230#section-3.2.4.\nIt causes an internal Node.js error on parsing this header.\n\nInvalid characters:\n{invalidChars}\n\nTo fix the problem, you can add the \'--insecure-http-parser\' flag to the \'NODE_OPTIONS\' environment variable:\n\nmacOS, Linux (bash, zsh)\nexport NODE_OPTIONS=\'--insecure-http-parser\'\n\nWindows (powershell)\n$env:NODE_OPTIONS=\'--insecure-http-parser\'\n\nWindows (cmd)\nset NODE_OPTIONS="--insecure-http-parser"\n\nand then start your tests.',
},
invalidHeaderCharacter: 'Character with code "{charCode}" in header "{name}" {location} at index {index}',
};
function getText(template, parameters) {
let errorStr = template;
for (const [parameterName, parameterValue] of Object.entries(parameters)) {
if (parameterValue)
errorStr = errorStr.replace(new RegExp(`{${parameterName}}`, 'g'), parameterValue);
}
return errorStr;
}
exports.getText = getText;