コード例 #1
0
        private static void MapAndThrowException(Exception exception, FutError futError)
        {
            switch (futError.Code)
            {
            case FutErrorCode.ExpiredSession:
                throw new ExpiredSessionException(futError, exception);

            case FutErrorCode.NotFound:
                throw new NotFoundException(futError, exception);

            case FutErrorCode.Conflict:
                throw new ConflictException(futError, exception);

            case FutErrorCode.BadRequest:
                throw new BadRequestException(futError, exception);

            case FutErrorCode.PermissionDenied:
                throw new PermissionDeniedException(futError, exception);

            case FutErrorCode.NotEnoughCredit:
                throw new NotEnoughCreditException(futError, exception);

            case FutErrorCode.NoSuchTradeExists:
                throw new NoSuchTradeExistsException(futError, exception);

            case FutErrorCode.InternalServerError:
                throw new InternalServerException(futError, exception);

            case FutErrorCode.ServiceUnavailable:
                throw new ServiceUnavailableException(futError, exception);

            default:
                var newException = new FutErrorException(futError, exception);
                throw new FutException(string.Format("Unknown EA error, please report on GitHub - {0}", newException.Message), newException);
            }
        }
コード例 #2
0
 public ServiceDisabledException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #3
0
 public DestinationFullException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #4
0
 public NotEnoughCreditException(FutError futError, Exception innerException)
     : base(futError, innerException)
 {
 }
コード例 #5
0
 public NotFoundException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #6
0
 public BadGatewayException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #7
0
 public AccountLockedException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #8
0
 public PermissionDeniedException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #9
0
ファイル: FutErrorException.cs プロジェクト: box90/FutToolKit
 public FutErrorException(FutError futError)
     : base(ExtractMessage(futError))
 {
     FutError = futError;
 }
コード例 #10
0
 public ServiceUnavailableException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #11
0
 public BadRequestException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #12
0
 public InvalidTransactionException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #13
0
 public InvalidDeckException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #14
0
 public WrongPriceRangeException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #15
0
ファイル: FutErrorException.cs プロジェクト: box90/FutToolKit
 public FutErrorException(FutError futError, Exception innerException)
     : base(ExtractMessage(futError), innerException)
 {
     FutError = futError;
 }
コード例 #16
0
 public PurchasedItemsFullException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #17
0
        private static void MapAndThrowException <T>(Exception exception, FutError futError) where T : class
        {
            switch (futError.Code)
            {
            case FutErrorCode.ExpiredSession:
                futError.Reason = $"Session expired - You need to relogin";
                throw new ExpiredSessionException(futError, exception);

            case FutErrorCode.NotFound:
                futError.Reason = $"Destination not found (404)";
                throw new NotFoundException(futError, exception);

            case FutErrorCode.Conflict:
                if (Activator.CreateInstance(typeof(T)) is ListAuctionResponse)
                {
                    futError.Reason = $"Conflict - Please check the EA pricerange";
                    throw new WrongPriceRangeException(futError, exception);
                }
                else
                {
                    futError.Reason = $"Conflict";
                    throw new ConflictException(futError, exception);
                }

            case FutErrorCode.BadRequest:
                futError.Reason = $"Bad Request";
                throw new BadRequestException(futError, exception);

            case FutErrorCode.PermissionDenied:
                futError.Reason = $"Permission Denied - You need to find the auction before bidding / Auction not existing";
                throw new PermissionDeniedException(futError, exception);

            case FutErrorCode.NotEnoughCredit:
                futError.Reason = $"Not enough coins";
                throw new NotEnoughCreditException(futError, exception);

            case FutErrorCode.NoSuchTradeExists:
                futError.Reason = $"Trade not found";
                throw new NoSuchTradeExistsException(futError, exception);

            case FutErrorCode.InternalServerError:
                if (Activator.CreateInstance(typeof(T)) is AuctionResponse)
                {
                    futError.Reason = $"Temporary Transfermarket BAN detected";
                    throw new TemporaryBanException(futError, exception);
                }
                else
                {
                    futError.Reason = $"Internal Server Error - FUT unavailable";
                    throw new InternalServerException(futError, exception);
                }

            case FutErrorCode.ServiceUnavailable:
                futError.Reason = $"Service Unavailable";
                throw new ServiceUnavailableException(futError, exception);

            case FutErrorCode.InvalidDeck:
                futError.Reason = $"Invalid Deck";
                throw new InvalidDeckException(futError, exception);

            case FutErrorCode.DestinationFull:
                futError.Reason = $"Destination Pile (Watchlist / Transferlist) is full";
                throw new DestinationFullException(futError, exception);

            case FutErrorCode.BadGateway:
                futError.Reason = $"Bad Gateway - Please try to relogin";
                throw new BadGatewayException(futError, exception);

            case FutErrorCode.InvalidCookie:
                futError.Reason = $"Invalid Cookie - Please try to relogin";
                throw new InvalidCookieException(futError, exception);

            case FutErrorCode.InvalidTransaction:
                futError.Reason = $"Invalid Transaction (i.e. if you try to list an aution which is still active)";
                throw new InvalidTransactionException(futError, exception);

            case FutErrorCode.PurchasedItemsFull:
                futError.Reason = $"Purchased Items Pile is full - You need to assign them to club or transferlist";
                throw new PurchasedItemsFullException(futError, exception);

            case FutErrorCode.NoRemainingAuthenticationAttemptsAccountLocked:
                futError.Reason = $"Account locked - You need to set the security question in a validated console";
                throw new AccountLockedException(futError, exception);

            case FutErrorCode.TooManyRequests:
                futError.Reason = $"Temporary BAN detected";
                throw new TemporaryBanException(futError, exception);

            case FutErrorCode.Unknown_HTTP_512:
                futError.Reason = $"Temporary BAN detected";
                throw new TemporaryBanException(futError, exception);

            case FutErrorCode.Unknown_HTTP_521:
                futError.Reason = $"Temporary BAN detected";
                throw new TemporaryBanException(futError, exception);

            case FutErrorCode.UpgradeRequired:
                futError.Reason = $"Temporary BAN detected";
                throw new TemporaryBanException(futError, exception);

            case FutErrorCode.ServiceDisabled:
                futError.Reason = $"FUT WebApp / CompanionApp disabled by EA";
                throw new ServiceDisabledException(futError, exception);

            case FutErrorCode.TransfermarketBlocked:
                futError.Reason = $"Transfermarket blocked by EA";
                throw new TransfermarketBlockedException(futError, exception);

            case FutErrorCode.CaptchaTriggered:
                futError.Reason = "Captcha triggered";
                throw new CaptchaTriggeredException(futError, exception);

            default:
                var newException = new FutErrorException(futError, exception);
                throw new FutException(string.Format("Unknown EA error, please report it on GitHub - {0}", newException.Message), newException);
            }
        }
コード例 #18
0
 public TransfermarketBlockedException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #19
0
 public ConflictException(FutError futError, Exception innerException)
     : base(futError, innerException)
 {
 }
コード例 #20
0
 public TemporaryBanException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #21
0
 public InvalidCookieException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #22
0
 public ExpiredSessionException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #23
0
 public InternalServerException(FutError futError, Exception exception)
     : base(futError, exception)
 {
 }
コード例 #24
0
 public NoSuchTradeExistsException(FutError futError, Exception innerException)
     : base(futError, innerException)
 {
 }
コード例 #25
0
 public CaptchaTriggeredException(FutError futError, Exception innerException)
     : base(futError, innerException)
 {
 }