Show some actual values in pokemon viewer (wip)

This commit is contained in:
Greg Edwards
2015-03-10 21:31:10 -04:00
parent b89eb29c62
commit 91fef43978
7 changed files with 292 additions and 15 deletions

48
web/src/WebException.cs Normal file
View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PkmnFoundations.Web
{
public class WebException : Exception
{
public WebException(String message, int responseCode) : base(message)
{
ResponseCode = responseCode;
}
public WebException(String message) : this(message, 500)
{
}
public WebException(int responseCode) : this(DefaultMessage(responseCode), responseCode)
{
}
public WebException() : this(500)
{
}
public int ResponseCode { get; private set; }
public static String DefaultMessage(int responseCode)
{
switch (responseCode)
{
case 400:
return "Bad request";
case 403:
return "Forbidden";
case 404:
return "Not found";
case 500:
default:
return "Server error";
}
}
}
}