{"record":{"id":"b640efcfd957b769","repo":"balderdashy/sails","slug":"e-invalid-b640ef","errorCode":"E_INVALID","errorMessage":"Must specify a non-empty string, but instead got: ${util.inspect(originUrl, {depth: null})}","messagePattern":"Must specify a non-empty string, but instead got: (.+?)\\)\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/util/check-origin-url.js","lineNumber":26,"sourceCode":"var util = require('util');\n\n\n/**\n * checkOriginUrl()\n *\n * @param {String} originUrl\n *        The origin URL to check.\n *        (This is used when parsing the relevant config from within `sails.config.security`\n *         or `sails.config.sockets`.)\n *\n * @throws {Error} if not valid\n *   @property {String} code  (==='E_INVALID')\n */\n\nmodule.exports = function checkOriginUrl(originUrl) {\n\n  if (!_.isString(originUrl) || originUrl === '') {\n    throw flaverr('E_INVALID', new Error('Must specify a non-empty string, but instead got: '+util.inspect(originUrl, {depth: null})));\n  }\n\n  if (!originUrl.match(/^https?:\\/\\//)) {\n    throw flaverr('E_INVALID', new Error('Must specify a protocol like http:// or https://, but instead got: '+originUrl));\n  }\n\n  // Now do a mostly-correct parse of the URL.\n  var parsedOriginUrl = url.parse(originUrl);\n\n  var isHttps = parsedOriginUrl.protocol === 'https:';\n\n  if (isHttps && parsedOriginUrl.port === '443') {\n    throw flaverr('E_INVALID', new Error('Should not explicitly specify port 443 with https:// (it is implied).  But instead got: '+originUrl));\n  }\n  if (!isHttps && parsedOriginUrl.port === '80') {\n    throw flaverr('E_INVALID', new Error('Should not explicitly specify port 80 with https:// (it is implied).  But instead got: '+originUrl));\n  }\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/util/check-origin-url.js#L8-L44","documentation":"Error \"Must specify a non-empty string, but instead got: ${util.inspect(originUrl, {depth: null})}\" thrown in balderdashy/sails.","triggerScenarios":"Thrown at lib/util/check-origin-url.js:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}