private int Map(BreadExceptionCode code)
        {
            switch (code)
            {
            case BreadExceptionCode.UserIsUnknown:
            case BreadExceptionCode.AlbumIdIsUnknown:
            case BreadExceptionCode.GroupIdIsUnknown:
            case BreadExceptionCode.PostIdIsUnknown:
                return(StatusCodes.Status404NotFound);

            case BreadExceptionCode.GroupIsClosed:
            case BreadExceptionCode.AlbumIsClosed:
            case BreadExceptionCode.PostIdIsClosed:
                return(StatusCodes.Status406NotAcceptable);

            case BreadExceptionCode.UserIsDenied:
                return(StatusCodes.Status403Forbidden);

            default:
                return(StatusCodes.Status400BadRequest);
            }
        }
示例#2
0
 public BreadException(BreadExceptionCode code, string message = null, Exception innerException = null)
     : base(message, innerException)
 {
     ExceptionCode = code;
 }