mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-09-30 21:26:43 -05:00
Show some actual values in pokemon viewer (wip)
This commit is contained in:
48
web/src/WebException.cs
Normal file
48
web/src/WebException.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user