From f9c47377ac0ceaf4555ebca1b415fd73cfb7ec75 Mon Sep 17 00:00:00 2001 From: kremsy Date: Mon, 12 Jan 2015 13:39:10 +0100 Subject: [PATCH] fault exception update --- .../DedicatedServer/Xmlrpc/FaultException.php | 71 +++++++++++++------ 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php b/libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php index 2f1950d4..387a6e5b 100755 --- a/libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php +++ b/libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php @@ -7,12 +7,9 @@ namespace Maniaplanet\DedicatedServer\Xmlrpc; -class FaultException extends Exception -{ - static function create($faultString, $faultCode) - { - switch($faultString) - { +class FaultException extends Exception { + static function create($faultString, $faultCode) { + switch ($faultString) { case 'Password incorrect.': case 'Permission denied.': return new AuthenticationException($faultString, $faultCode); @@ -57,6 +54,7 @@ class FaultException extends Exception case 'invalid index': return new IndexOutOfBoundException($faultString, $faultCode); case 'the next map must be different from the current one.': + case 'No next map currently defined.': return new NextMapException($faultString, $faultCode); case 'Change in progress.': return new ChangeInProgressException($faultString, $faultCode); @@ -89,26 +87,55 @@ class FaultException extends Exception case 'Invalid url.': return new FileException($faultString, $faultCode); } - if(preg_match('~^Unknown setting \'.*\'\.$~iu', $faultString)) + if (preg_match('~^Unknown setting \'.*\'\.$~iu', $faultString)) { return new GameModeException($faultString, $faultCode); - if(preg_match('~^Couldn\'t load \'.*\'\.$~iu', $faultString)) + } + if (preg_match('~^Couldn\'t load \'.*\'\.$~iu', $faultString)) { return new FileException($faultString, $faultCode); + } return new self($faultString, $faultCode); } } -class AuthenticationException extends FaultException {} -class UnavailableFeatureException extends FaultException {} -class LockedFeatureException extends FaultException {} -class UnknownPlayerException extends FaultException {} -class PlayerStateException extends FaultException {} -class AlreadyInListException extends FaultException {} -class NotInListException extends FaultException {} -class IndexOutOfBoundException extends FaultException {} -class NextMapException extends FaultException{} -class ChangeInProgressException extends FaultException {} -class InvalidMapException extends FaultException{} -class GameModeException extends FaultException {} -class ServerOptionsException extends FaultException {} -class FileException extends FaultException {} +class AuthenticationException extends FaultException { +} + +class UnavailableFeatureException extends FaultException { +} + +class LockedFeatureException extends FaultException { +} + +class UnknownPlayerException extends FaultException { +} + +class PlayerStateException extends FaultException { +} + +class AlreadyInListException extends FaultException { +} + +class NotInListException extends FaultException { +} + +class IndexOutOfBoundException extends FaultException { +} + +class NextMapException extends FaultException { +} + +class ChangeInProgressException extends FaultException { +} + +class InvalidMapException extends FaultException { +} + +class GameModeException extends FaultException { +} + +class ServerOptionsException extends FaultException { +} + +class FileException extends FaultException { +}