# Error Message

When a failed login occurs from Captive Portal, the user will be redirected to the splash page again with 2 additional query parameters **res** and **reason** to indicate the error. The https request to the splash page could be like this:

```
https://yourwebsite.com/splash.html?actionurl=......&res=failed&reason=xxxx
```

These 2 parameters can be used for displaying error message on splash page. The usage is depicted in the following table:

<table><thead><tr><th>Parameters</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>res=failed&#x26;reason=reject</td><td>Invalid username or password.</td><td></td></tr><tr><td>res=failed&#x26;reason=timeout</td><td>No response from authentication server.</td><td></td></tr><tr><td>res=failed&#x26;reason=mtu</td><td>Abnormal network error.</td><td></td></tr><tr><td>res=failed&#x26;reason=other</td><td>Other errors. </td><td></td></tr></tbody></table>

## Reference Code

The following JavaScript code illustrates how to display error message in splash page.

```
   <script>
      function check_error(){
        const params = new Proxy(new URLSearchParams(window.location.search), {
          get: (searchParams, prop) => searchParams.get(prop),
        });
        if (params.res === "failed") {
          switch(params.reason) {
            case "reject":
              alert("Invalid Username or Password.");
              break;
            case "timeout":
              alert("No response from authentication server.");
              break;
            case "mtu":
              alert("Abnormal network error.");
              break;
            case "other":
              alert("Other errors.");
              break;
            default:
              alert("Other errors. (no reason)");
          }
        }
      }
    </script>    
  </head>

  <body onload="check_error()" style="">
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.engenius.ai/home-cloud-white-papers/captive-portal/external-splash-page/error-message.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
