better error handling

git-svn-id: http://yolanda.mister-muffin.de/svn@119 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2007-10-21 22:55:29 +00:00
parent 0add0ca847
commit ede7e62565
5 changed files with 117 additions and 19 deletions

View file

@ -68,9 +68,24 @@ if($query->param('id'))
} }
else else
{ {
#the requested id doesn't exist %page = ();
print $session->header();
print "this video doesn't exist"; #if a username is associated with session id, username is nonempty
$page->{'username'} = get_username_from_sid($session->id);
$page->{'locale'} = $locale;
$page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
#print xml http header along with session cookie
print $session->header(-type=>'text/xml');
#print xml
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }
#disconnect db #disconnect db
@ -78,7 +93,22 @@ if($query->param('id'))
} }
else else
{ {
#if not, print error %page = ();
print $session->header();
print "you stupid moron forgot to pass an id..."; #if a username is associated with session id, username is nonempty
$page->{'username'} = get_username_from_sid($session->id);
$page->{'locale'} = $locale;
$page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
#print xml http header along with session cookie
print $session->header(-type=>'text/xml');
#print xml
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }

View file

@ -127,6 +127,22 @@ elsif($query->param('sort'))
} }
else else
{ {
print $session->header(); %page = ();
print "no query passed";
#if a username is associated with session id, username is nonempty
$page->{'username'} = get_username_from_sid($session->id);
$page->{'locale'} = $locale;
$page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
#print xml http header along with session cookie
print $session->header(-type=>'text/xml');
#print xml
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }

View file

@ -13,9 +13,12 @@ if($username)
%page = (); %page = ();
#if a username is associated with session id, username is nonempty #if a username is associated with session id, username is nonempty
$page->{username} = get_username_from_sid($session->id); $page->{'username'} = get_username_from_sid($session->id);
$page->{locale} = $locale; $page->{'locale'} = $locale;
$page->{stylesheet} = $stylesheet; $page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{uploadform} = ['']; $page->{uploadform} = [''];
#print xml http header along with session cookie #print xml http header along with session cookie
@ -25,6 +28,22 @@ if($username)
} }
else else
{ {
print $session->header(); %page = ();
print "nope...";
#if a username is associated with session id, username is nonempty
$page->{'username'} = get_username_from_sid($session->id);
$page->{'locale'} = $locale;
$page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
#print xml http header along with session cookie
print $session->header(-type=>'text/xml');
#print xml
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }

View file

@ -59,6 +59,22 @@ if($userid)
} }
else else
{ {
print $session->header(); %page = ();
print "nope...";
#if a username is associated with session id, username is nonempty
$page->{'username'} = get_username_from_sid($session->id);
$page->{'locale'} = $locale;
$page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
#print xml http header along with session cookie
print $session->header(-type=>'text/xml');
#print xml
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }

View file

@ -53,7 +53,8 @@ if($query->param('title') or $query->param('id'))
{ {
#still no results #still no results
#there is nothing we can do now - this video doesn't exist... #there is nothing we can do now - this video doesn't exist...
#TODO: insert error output $page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
} }
elsif($rowcount == 1) elsif($rowcount == 1)
{ {
@ -162,6 +163,22 @@ if($query->param('title') or $query->param('id'))
} }
else else
{ {
print $session->header(); %page = ();
print "no query passed";
#if a username is associated with session id, username is nonempty
$page->{'username'} = get_username_from_sid($session->id);
$page->{'locale'} = $locale;
$page->{'stylesheet'} = $stylesheet;
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
#print xml http header along with session cookie
print $session->header(-type=>'text/xml');
#print xml
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }