{"record":{"id":"81b20999fbf34539","repo":"hpyhacking/peatio","slug":"invalid-handler-in-when","errorCode":null,"errorMessage":"invalid 'handler' in when()","messagePattern":"invalid 'handler' in when\\(\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/assets/javascripts/lib/angular-ui-router.js","lineNumber":1490,"sourceCode":"   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when = function (what, handler) {\n    var redirect, handlerIsString = isString(handler);\n    if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n    if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n      throw new Error(\"invalid 'handler' in when()\");\n\n    var strategies = {\n      matcher: function (what, handler) {\n        if (handlerIsString) {\n          redirect = $urlMatcherFactory.compile(handler);\n          handler = ['$match', function ($match) { return redirect.format($match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n        }, {\n          prefix: isString(what.prefix) ? what.prefix : ''\n        });\n      },\n      regex: function (what, handler) {\n        if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n        if (handlerIsString) {\n          redirect = handler;","sourceCodeStart":1472,"sourceCodeEnd":1508,"githubUrl":"https://github.com/hpyhacking/peatio/blob/dab8641137c008928c835409342519bfef4eae7f/app/assets/javascripts/lib/angular-ui-router.js#L1472-L1508","documentation":"Error \"invalid 'handler' in when()\" thrown in hpyhacking/peatio.","triggerScenarios":"Thrown at app/assets/javascripts/lib/angular-ui-router.js:1490 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a redirect string or a handler function as the second argument to $urlRouterProvider.when(); other types are rejected."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dab8641137c008928c835409342519bfef4eae7f","analyzedAt":"2026-08-23T09:59:18.005Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}