Permalink
Browse files

deal with failing to parse the url or title, return 400 and give the …

…hint.
  • Loading branch information...
1 parent 1f86565 commit d0b795e1213a2c718cf56605115e69d9d958c88d @ydoovv ydoovv committed Oct 18, 2010
Showing with 11 additions and 4 deletions.
  1. +8 −4 freejump.py
  2. +3 −0 templates/main.html
View
@@ -49,10 +49,14 @@ def get(self):
if not url:
self.response.out.write("Please give us the url...")
return
- actual_url = self.get_actual_url(url)
- actual_title = ""
- if title:
- actual_title = self.get_title(actual_url)
+ try:
+ actual_url = self.get_actual_url(url)
+ actual_title = ""
+ if title:
+ actual_title = self.get_title(actual_url)
+ except:
+ self.error(400)
+ return
if nojump:
self.response.out.write("%s:;;:%s" % (actual_url,
actual_title and actual_title or ""))
View
@@ -189,6 +189,9 @@
_rlipb337145(res[0], res[1]); // longurl & title
obj.textContent = "Saved!";
}
+ if (xmlHttp.status == 400) {
+ obj.textContent = "Failed. Check your link or try again?";
+ }
}
else {
//obj.textContent = "Please wait...... We are getting the original url and title of the shortened url.";

0 comments on commit d0b795e

Please sign in to comment.