Invalid url using javascript

I have an issue in my project regarding JavaScript.

Here is a brief description about the issue.Please go through with this.

Issue: If an invalid URL is entered, the Results page should display "Path not found.

In my website there is search menu Find it.if you go select some check boxes and click on find button, it will generate a dynamic url.

Here is the url

In the above url particularly in this part(— (data:(area:‘’,category:‘163’,pm:!((i:1197,v:!n),(i:2324,v:!n),(i:2325,v:!n),(i:1683,v:!n)),view:list),sc:1) – ) if user inserts invalid text and refresh the page, it has to display path not found in results page.

I have very limited time,can anyone please help me how can I solve this.