diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php
index 144a7a2a15066a57e322bbc7a7b2ab39d94502a6..1353d01bcecce1b15525cac48da211e45fb387c1 100644
--- a/modules/adfs/lib/IdP/ADFS.php
+++ b/modules/adfs/lib/IdP/ADFS.php
@@ -25,7 +25,7 @@ class sspmod_adfs_IdP_ADFS {
 			SimpleSAML_Logger::info('ADFS - IdP.prp: Incoming Authentication request: '.$issuer.' id '.$requestid);
 	
 		} catch(Exception $exception) {
-			SimpleSAML_Utilities::fatalError($session->getTrackID(), 'PROCESSAUTHNREQUEST', $exception);
+			throw new SimpleSAML_Error_Error('PROCESSAUTHNREQUEST', $exception);
 		}
 		
 		$sessionLostURL = NULL; // TODO?
diff --git a/modules/discopower/www/disco.php b/modules/discopower/www/disco.php
index daf51ea78abb193af37cb07cc8cf13304dedfd3c..4241002a9e980175c9dc493ad9d9419a25b55823 100644
--- a/modules/discopower/www/disco.php
+++ b/modules/discopower/www/disco.php
@@ -2,20 +2,18 @@
 
 require_once('../www/_include.php');
 
-$session = SimpleSAML_Session::getInstance();
-
 try {
 	$discoHandler = new sspmod_discopower_PowerIdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'poweridpdisco');
 } catch (Exception $exception) {
 	/* An error here should be caused by invalid query parameters. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'DISCOPARAMS', $exception);
+	throw new SimpleSAML_Error_Error('DISCOPARAMS', $exception);
 }
 
 try {
 	$discoHandler->handleRequest();
 } catch(Exception $exception) {
 	/* An error here should be caused by metadata. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 ?>
\ No newline at end of file
diff --git a/modules/openid/www/initopenid.php b/modules/openid/www/initopenid.php
index 9db74fa6082b10ba2f71fdbe7f5cd5c761dc76d1..704c2c8fa7076daf53d72249033c1a2dd80ce6e8 100644
--- a/modules/openid/www/initopenid.php
+++ b/modules/openid/www/initopenid.php
@@ -12,7 +12,7 @@ $config = SimpleSAML_Configuration::getInstance();
 $session = SimpleSAML_Session::getInstance();
 
 if (empty($_REQUEST['RelayState'])) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 if (! $session->isValid('openid') ) {
diff --git a/www/auth/login-admin.php b/www/auth/login-admin.php
index 347b199699609ab555aebd6a1ada645dbc665fcb..f20dfc28c998fea906a2bcae5691f425b2b907db 100644
--- a/www/auth/login-admin.php
+++ b/www/auth/login-admin.php
@@ -17,10 +17,7 @@ $username = null;
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError(
-		$session->getTrackID(),
-		'NORELAYSTATE'
-		);
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 $relaystate = $_REQUEST['RelayState'];
@@ -28,10 +25,7 @@ $relaystate = $_REQUEST['RelayState'];
 $correctpassword = $config->getString('auth.adminpassword', '123');
 
 if (empty($correctpassword) or $correctpassword === '123') {
-	SimpleSAML_Utilities::fatalError(
-		$session->getTrackID(),
-		'NOTSET'
-	);
+	throw new SimpleSAML_Error_Error('NOTSET');
 }
 
 
diff --git a/www/auth/login-cas-ldap.php b/www/auth/login-cas-ldap.php
index 727a4487085fa9e5b5e540a49455949459b830fe..9a5419e640de70b8229b2eaef204fd0584e6f5f8 100755
--- a/www/auth/login-cas-ldap.php
+++ b/www/auth/login-cas-ldap.php
@@ -33,7 +33,7 @@ try {
 	
 	
 } catch (Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 /*
@@ -41,7 +41,7 @@ try {
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 
@@ -135,7 +135,7 @@ try {
 	SimpleSAML_Utilities::redirect($relaystate);
 
 } catch(Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CASERROR', $exception);
+	throw new SimpleSAML_Error_Error('CASERROR', $exception);
 }
 
 
diff --git a/www/auth/login-ldapmulti.php b/www/auth/login-ldapmulti.php
index 4242990aee929ce504a3eedd3541d118aecb92e7..8d36b67f08960036a8210111d125461e851fe30c 100644
--- a/www/auth/login-ldapmulti.php
+++ b/www/auth/login-ldapmulti.php
@@ -20,7 +20,7 @@ $attributes = array();
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 if (isset($_POST['username'])) {
diff --git a/www/auth/login-radius.php b/www/auth/login-radius.php
index 073b90e84553646fc95dbdced0435ffbf650e972..c9096ac1faaa31823f3d1a34ba1ce5ab15431545 100644
--- a/www/auth/login-radius.php
+++ b/www/auth/login-radius.php
@@ -16,7 +16,7 @@ $attributes = array();
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 if (isset($_POST['username'])) {
diff --git a/www/auth/login-tlsclient.php b/www/auth/login-tlsclient.php
index af8f164c61eaf5f8d3faf618e0e0e89280691d93..e63059c74fb0d9df407ef0feeb947edb2ff2a183 100644
--- a/www/auth/login-tlsclient.php
+++ b/www/auth/login-tlsclient.php
@@ -20,7 +20,7 @@ $username = null;
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 $relaystate = $_REQUEST['RelayState'];
@@ -35,7 +35,7 @@ try {
 		throw new Exception('Apache header variable SSL_CLIENT_VERIFY was not available. Recheck your apache configuration.');
 	
 	if (strcmp($_SERVER['SSL_CLIENT_VERIFY'], "SUCCESS") != 0) {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOTVALIDCERT', $e);
+		throw new SimpleSAML_Error_Error('NOTVALIDCERT', $e);
 	}
 	
 	$userid = $_SERVER['SSL_CLIENT_S_DN'];
@@ -73,7 +73,7 @@ try {
 	
 	
 } catch (Exception $e) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CONFIG', $e);
+	throw new SimpleSAML_Error_Error('CONFIG', $e);
 
 }
 
diff --git a/www/auth/login-wayf-ldap.php b/www/auth/login-wayf-ldap.php
index 4fac5c4d7a71cba164a47a760713500b38a8d7a3..f8eef7513aa03ee40e39420f367b09dfa48d19e2 100755
--- a/www/auth/login-wayf-ldap.php
+++ b/www/auth/login-wayf-ldap.php
@@ -31,7 +31,7 @@ try {
 	$ldapconfig = $casldapconfig[$idpentityid]['ldap'];
 	
 } catch (Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 /*
@@ -39,7 +39,7 @@ try {
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 $relaystate = $_REQUEST['RelayState'];
@@ -62,7 +62,7 @@ if ($username = $_POST['username']) {
 			SimpleSAML_Utilities::redirect($relaystate);
 		}
 	} catch(Exception $e) {
-			SimpleSAML_Utilities::fatalError($session->getTrackID(), 'LDAPERROR', $e);
+			throw new SimpleSAML_Error_Error('LDAPERROR', $e);
 	}
 }
 
diff --git a/www/auth/login.php b/www/auth/login.php
index e92564b0d8e21cf8b9dd7b041daacc121afb9405..093a82b3f37cd136369bcf5c80210c72f71daaca 100644
--- a/www/auth/login.php
+++ b/www/auth/login.php
@@ -21,7 +21,7 @@ $username = null;
  * we should redirect the user to after a successful authentication.
  */
 if (!array_key_exists('RelayState', $_REQUEST)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 $relaystate = $_REQUEST['RelayState'];
diff --git a/www/authmemcookie.php b/www/authmemcookie.php
index 5cb5b1e27ce916a9bb79eea72d75fa82a8d11724..3b2729d925b5d2f3c77f2e1953dc793e66e57c05 100644
--- a/www/authmemcookie.php
+++ b/www/authmemcookie.php
@@ -19,7 +19,7 @@ try {
 
 	/* Check if this module is enabled. */
 	if(!$globalConfig->getBoolean('enable.authmemcookie', FALSE)) {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+		throw new SimpleSAML_Error_Error('NOACCESS');
 	}
 
 	/* Load Auth MemCookie configuration. */
@@ -120,5 +120,5 @@ try {
 	/* Redirect the user back to this page to signal that the login is completed. */
 	SimpleSAML_Utilities::redirect(SimpleSAML_Utilities::selfURL());
 } catch(Exception $e) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CONFIG', $e);
+	throw new SimpleSAML_Error_Error('CONFIG', $e);
 }
diff --git a/www/saml2/idp/initSLO.php b/www/saml2/idp/initSLO.php
index a1e12f4bd13efaa79f805d4638dfc466001f448b..47de1b57bea6d8641364e83f8ca8acc9ae40b8c0 100644
--- a/www/saml2/idp/initSLO.php
+++ b/www/saml2/idp/initSLO.php
@@ -4,17 +4,16 @@ require_once('../../../www/_include.php');
 
 $config = SimpleSAML_Configuration::getInstance();
 $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-$session = SimpleSAML_Session::getInstance();
 
 SimpleSAML_Logger::info('SAML2.0 - IdP.initSLO: Accessing SAML 2.0 IdP endpoint init Single Logout');
 
 if (!$config->getBoolean('enable.saml20-idp', false)) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 }
 
 
 if (!isset($_GET['RelayState'])) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 $returnTo = $_GET['RelayState'];
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 9cd1f96011794b80aae221853d88ce3302600231..216b3e7a3c15a23587f43d4eda3df9e39c1e7625 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -5,10 +5,9 @@ require_once('../../_include.php');
 /* Load simpleSAMLphp, configuration and metadata */
 $config = SimpleSAML_Configuration::getInstance();
 $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-$session = SimpleSAML_Session::getInstance();
 
 if (!$config->getBoolean('enable.saml20-idp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 /* Check if valid local session exists.. */
 if ($config->getBoolean('admin.protectmetadata', false)) {
@@ -108,7 +107,7 @@ try {
 
 } catch(Exception $exception) {
 
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 
 }
 
diff --git a/www/saml2/sp/AssertionConsumerService.php b/www/saml2/sp/AssertionConsumerService.php
index e4b6a6bd6b60d554f211d071bfafd4a03192edef..7065f049c779a40babbf1cbd3b77a698d633501e 100644
--- a/www/saml2/sp/AssertionConsumerService.php
+++ b/www/saml2/sp/AssertionConsumerService.php
@@ -52,7 +52,7 @@ function finishLogin($authProcState) {
 SimpleSAML_Logger::info('SAML2.0 - SP.AssertionConsumerService: Accessing SAML 2.0 SP endpoint AssertionConsumerService');
 
 if (!$config->getBoolean('enable.saml20-sp', TRUE))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 if (array_key_exists(SimpleSAML_Auth_ProcessingChain::AUTHPARAM, $_REQUEST)) {
 	/* We have returned from the authentication processing filters. */
@@ -98,7 +98,7 @@ try {
 		}
 		if(empty($info['RelayState'])) {
 			/* RelayState missing. */
-			SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+			throw new SimpleSAML_Error_Error('NORELAYSTATE');
 		}
 	}
 
@@ -115,7 +115,7 @@ try {
 		}
 
 		/* We don't have an error handler. Show an error page. */
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'RESPONSESTATUSNOSUCCESS', $e);
+		throw new SimpleSAML_Error_Error('RESPONSESTATUSNOSUCCESS', $e);
 	}
 
 
@@ -156,7 +156,7 @@ try {
 	finishLogin($authProcState);
 
 } catch(Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'PROCESSASSERTION', $exception);
+	throw new SimpleSAML_Error_Error('PROCESSASSERTION', $exception);
 }
 
 
diff --git a/www/saml2/sp/SingleLogoutService.php b/www/saml2/sp/SingleLogoutService.php
index 9a07973e0ef01201023fc2dcac841cc67b0ffe9b..b04f850aef8536bc518dc8a89e3b3fe329b95b95 100644
--- a/www/saml2/sp/SingleLogoutService.php
+++ b/www/saml2/sp/SingleLogoutService.php
@@ -12,7 +12,7 @@ $session = SimpleSAML_Session::getInstance();
 SimpleSAML_Logger::info('SAML2.0 - SP.SingleLogoutService: Accessing SAML 2.0 SP endpoint SingleLogoutService');
 
 if (!$config->getBoolean('enable.saml20-sp', TRUE))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 
 
@@ -58,7 +58,7 @@ if ($message instanceof SAML2_LogoutRequest) {
 		$binding->setDestination(sspmod_saml_Message::getDebugDestination());
 		$binding->send($lr);
 	} catch (Exception $exception) {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'LOGOUTREQUEST', $exception);
+		throw new SimpleSAML_Error_Error('LOGOUTREQUEST', $exception);
 	}
 
 } elseif ($message instanceof SAML2_LogoutResponse) {
@@ -73,13 +73,13 @@ if ($message instanceof SAML2_LogoutRequest) {
 
 	$returnTo = $session->getData('spLogoutReturnTo', $id);
 	if (empty($returnTo)) {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'LOGOUTINFOLOST');
+		throw new SimpleSAML_Error_Error('LOGOUTINFOLOST');
 	}
 
 	SimpleSAML_Utilities::redirect($returnTo);
 
 } else {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'SLOSERVICEPARAMS');
+	throw new SimpleSAML_Error_Error('SLOSERVICEPARAMS');
 }
 
 
diff --git a/www/saml2/sp/idpdisco.php b/www/saml2/sp/idpdisco.php
index 3cfdc17e37c6baa98c16e58018cdcae07b2971a2..6425cddf77c2f6f68f9c4733c9b011397087aea9 100644
--- a/www/saml2/sp/idpdisco.php
+++ b/www/saml2/sp/idpdisco.php
@@ -2,20 +2,18 @@
 
 require_once('../../_include.php');
 
-$session = SimpleSAML_Session::getInstance();
-
 try {
 	$discoHandler = new SimpleSAML_XHTML_IdPDisco(array('saml20-idp-remote'), 'saml20');
 } catch (Exception $exception) {
 	/* An error here should be caused by invalid query parameters. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'DISCOPARAMS', $exception);
+	throw new SimpleSAML_Error_Error('DISCOPARAMS', $exception);
 }
 
 try {
 	$discoHandler->handleRequest();
 } catch(Exception $exception) {
 	/* An error here should be caused by metadata. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 ?>
\ No newline at end of file
diff --git a/www/saml2/sp/initSLO.php b/www/saml2/sp/initSLO.php
index 16b188ccd9ccfe6fb25a03d892dc8dec0ebd49ab..dd19558d718ec23df86ef51ad832d81dcfdfe73a 100644
--- a/www/saml2/sp/initSLO.php
+++ b/www/saml2/sp/initSLO.php
@@ -9,13 +9,13 @@ $session = SimpleSAML_Session::getInstance();
 SimpleSAML_Logger::info('SAML2.0 - SP.initSLO: Accessing SAML 2.0 SP initSLO script');
 
 if (!$config->getBoolean('enable.saml20-sp', TRUE))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 
 if (isset($_REQUEST['RelayState'])) {
 	$returnTo = $_REQUEST['RelayState'];
 } else {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 
@@ -57,7 +57,7 @@ try {
 
 
 } catch(Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CREATEREQUEST', $exception);
+	throw new SimpleSAML_Error_Error('CREATEREQUEST', $exception);
 }
 
 
diff --git a/www/saml2/sp/initSSO.php b/www/saml2/sp/initSSO.php
index 05e7cb40f6b657d8a7253e251b0c49ca85046dea..d38ce8a73e3b5a676f965fd5e4266e6d78adb291 100644
--- a/www/saml2/sp/initSSO.php
+++ b/www/saml2/sp/initSSO.php
@@ -10,7 +10,7 @@ $session = SimpleSAML_Session::getInstance();
 SimpleSAML_Logger::info('SAML2.0 - SP.initSSO: Accessing SAML 2.0 SP initSSO script');
 
 if (!$config->getBoolean('enable.saml20-sp', TRUE))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 /*
  * Incomming URL parameters
@@ -21,7 +21,7 @@ if (!$config->getBoolean('enable.saml20-sp', TRUE))
  */		
 
 if (empty($_GET['RelayState'])) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 $reachableIDPs = array();
@@ -70,7 +70,7 @@ try {
 	
 
 } catch (Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 /*
@@ -169,7 +169,7 @@ try {
 	$b->send($ar);
 
 } catch(Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CREATEREQUEST', $exception);
+	throw new SimpleSAML_Error_Error('CREATEREQUEST', $exception);
 }
 
 ?>
\ No newline at end of file
diff --git a/www/saml2/sp/metadata.php b/www/saml2/sp/metadata.php
index 63fb36614c696a8dc52ffd6657c6925801358ef0..03331212ccda6e9e35d3f03aa60a1a6587bd0b9a 100644
--- a/www/saml2/sp/metadata.php
+++ b/www/saml2/sp/metadata.php
@@ -5,11 +5,10 @@ require_once('../../_include.php');
 /* Load simpleSAMLphp, configuration and metadata */
 $config = SimpleSAML_Configuration::getInstance();
 $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-$session = SimpleSAML_Session::getInstance();
 
 
 if (!$config->getValue('enable.saml20-sp', TRUE))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 /* Check if valid local session exists.. */
 if ($config->getBoolean('admin.protectmetadata', false)) {
@@ -94,7 +93,7 @@ try {
 	
 } catch(Exception $exception) {
 	
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 
 }
 
diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php
index c386966a06a1c0881dd9476e796e53cc234e90bf..27a97b427a71b76b1a49b32f01d49c4869d06ee1 100644
--- a/www/shib13/idp/metadata.php
+++ b/www/shib13/idp/metadata.php
@@ -5,10 +5,9 @@ require_once('../../_include.php');
 /* Load simpleSAMLphp, configuration and metadata */
 $config = SimpleSAML_Configuration::getInstance();
 $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-$session = SimpleSAML_Session::getInstance();
 
 if (!$config->getBoolean('enable.shib13-idp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 /* Check if valid local session exists.. */
 if ($config->getBoolean('admin.protectmetadata', false)) {
@@ -91,7 +90,7 @@ try {
 	
 } catch(Exception $exception) {
 	
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 
 }
 
diff --git a/www/shib13/sp/AssertionConsumerService.php b/www/shib13/sp/AssertionConsumerService.php
index 5f368efb52d4670c8e45c0f05d4bcd2d6f99f002..90ef7618ea175681be3cd52ca66344bd70619206 100644
--- a/www/shib13/sp/AssertionConsumerService.php
+++ b/www/shib13/sp/AssertionConsumerService.php
@@ -40,7 +40,7 @@ function finishLogin($authProcState) {
 SimpleSAML_Logger::info('Shib1.3 - SP.AssertionConsumerService: Accessing Shibboleth 1.3 SP endpoint AssertionConsumerService');
 
 if (!$config->getBoolean('enable.shib13-sp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 if (array_key_exists(SimpleSAML_Auth_ProcessingChain::AUTHPARAM, $_REQUEST)) {
 	/* We have returned from the authentication processing filters. */
@@ -51,7 +51,7 @@ if (array_key_exists(SimpleSAML_Auth_ProcessingChain::AUTHPARAM, $_REQUEST)) {
 }
 
 if (empty($_POST['SAMLResponse'])) 
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'ACSPARAMS', $exception);
+	throw new SimpleSAML_Error_Error('ACSPARAMS', $exception);
 
 try {
 
@@ -74,7 +74,7 @@ try {
 
 	$relayState = $authnResponse->getRelayState();
 	if (!isset($relayState)) {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+		throw new SimpleSAML_Error_Error('NORELAYSTATE');
 	}
 
 	$spmetadata = $metadata->getMetaData(NULL, 'shib13-sp-hosted');
@@ -100,7 +100,7 @@ try {
 	finishLogin($authProcState);
 
 } catch(Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'GENERATEAUTHNRESPONSE', $exception);
+	throw new SimpleSAML_Error_Error('GENERATEAUTHNRESPONSE', $exception);
 }
 
 
diff --git a/www/shib13/sp/idpdisco.php b/www/shib13/sp/idpdisco.php
index dfaf3e86b3931597c6d3cfd16f909390ad5e091a..b9c563e08ed145435ad23a5cba208094c78301e3 100644
--- a/www/shib13/sp/idpdisco.php
+++ b/www/shib13/sp/idpdisco.php
@@ -2,20 +2,18 @@
 
 require_once('../../_include.php');
 
-$session = SimpleSAML_Session::getInstance();
-
 try {
 	$discoHandler = new SimpleSAML_XHTML_IdPDisco(array('shib13-idp-remote'), 'shib13');
 } catch (Exception $exception) {
 	/* An error here should be caused by invalid query parameters. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'DISCOPARAMS', $exception);
+	throw new SimpleSAML_Error_Error('DISCOPARAMS', $exception);
 }
 
 try {
 	$discoHandler->handleRequest();
 } catch(Exception $exception) {
 	/* An error here should be caused by metadata. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 ?>
\ No newline at end of file
diff --git a/www/shib13/sp/initSSO.php b/www/shib13/sp/initSSO.php
index e538e28fbabd337587f9ab64ab48f274c08cb4f3..4af706c76521176f424a3c33702659610561b072 100644
--- a/www/shib13/sp/initSSO.php
+++ b/www/shib13/sp/initSSO.php
@@ -21,7 +21,7 @@ $session = SimpleSAML_Session::getInstance();
 SimpleSAML_Logger::info('Shib1.3 - SP.initSSO: Accessing Shib 1.3 SP initSSO script');
 
 if (!$config->getBoolean('enable.shib13-sp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 
 try {
@@ -36,7 +36,7 @@ try {
 
 
 } catch (Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 
@@ -78,7 +78,7 @@ if (!isset($session) || !$session->isValid('shib13') ) {
 		SimpleSAML_Utilities::redirect($url);
 	
 	} catch(Exception $exception) {		
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CREATEREQUEST', $exception);
+		throw new SimpleSAML_Error_Error('CREATEREQUEST', $exception);
 	}
 
 } else {
@@ -90,7 +90,7 @@ if (!isset($session) || !$session->isValid('shib13') ) {
 		SimpleSAML_Logger::info('Shib1.3 - SP.initSSO: Already Authenticated, Go back to RelayState');
 		SimpleSAML_Utilities::redirect($relaystate);
 	} else {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+		throw new SimpleSAML_Error_Error('NORELAYSTATE');
 	}
 
 }
diff --git a/www/shib13/sp/metadata.php b/www/shib13/sp/metadata.php
index ab0e93d4ddae3cb1af1e71a18ee468b4de217f6e..2bc4f8733f43c586dd459906a1d0a68f25fd7c14 100644
--- a/www/shib13/sp/metadata.php
+++ b/www/shib13/sp/metadata.php
@@ -5,11 +5,10 @@ require_once('../../_include.php');
 /* Load simpleSAMLphp, configuration and metadata */
 $config = SimpleSAML_Configuration::getInstance();
 $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-$session = SimpleSAML_Session::getInstance();
 
 
 if (!$config->getBoolean('enable.shib13-sp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 /* Check if valid local session exists.. */
 if ($config->getBoolean('admin.protectmetadata', false)) {
@@ -96,7 +95,7 @@ try {
 	
 } catch(Exception $exception) {
 	
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 
 }
 
diff --git a/www/wsfed/sp/idpdisco.php b/www/wsfed/sp/idpdisco.php
index 1a9e584737e348956e013eede22407ae45155fbd..fe6f0b6a994d5494fcfa3ceda37ddf88bb23cbd1 100644
--- a/www/wsfed/sp/idpdisco.php
+++ b/www/wsfed/sp/idpdisco.php
@@ -2,20 +2,18 @@
 
 require_once('../../_include.php');
 
-$session = SimpleSAML_Session::getInstance();
-
 try {
 	$discoHandler = new SimpleSAML_XHTML_IdPDisco(array('wsfed-idp-remote'), 'wsfed');
 } catch (Exception $exception) {
 	/* An error here should be caused by invalid query parameters. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'DISCOPARAMS', $exception);
+	throw new SimpleSAML_Error_Error('DISCOPARAMS', $exception);
 }
 
 try {
 	$discoHandler->handleRequest();
 } catch(Exception $exception) {
 	/* An error here should be caused by metadata. */
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 ?>
\ No newline at end of file
diff --git a/www/wsfed/sp/initSLO.php b/www/wsfed/sp/initSLO.php
index 0132f9284b97a8aac41a3974b4ffb846b1114dea..13b39d1a7c7d87acbb3fc100e0dbb6d3624bc9d9 100644
--- a/www/wsfed/sp/initSLO.php
+++ b/www/wsfed/sp/initSLO.php
@@ -9,13 +9,13 @@ $session = SimpleSAML_Session::getInstance();
 SimpleSAML_Logger::info('WS-Fed - SP.initSLO: Accessing WS-Fed SP initSLO script');
 
 if (!$config->getBoolean('enable.wsfed-sp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 
 if (isset($_REQUEST['RelayState'])) {
 	$returnTo = $_REQUEST['RelayState'];
 } else {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 	
@@ -47,7 +47,7 @@ if (isset($session) ) {
 		
 
 	} catch(Exception $exception) {
-		SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CREATEREQUEST', $exception);
+		throw new SimpleSAML_Error_Error('CREATEREQUEST', $exception);
 	}
 
 } else {
diff --git a/www/wsfed/sp/initSSO.php b/www/wsfed/sp/initSSO.php
index 9be61bf976bd67faa2b0f232b227188d061d75b3..fd038b5d97293ea44c6070ebc942c7c495935f47 100644
--- a/www/wsfed/sp/initSSO.php
+++ b/www/wsfed/sp/initSSO.php
@@ -15,15 +15,14 @@ require_once('../../_include.php');
 
 $config = SimpleSAML_Configuration::getInstance();
 $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-$session = SimpleSAML_Session::getInstance();
 
 SimpleSAML_Logger::info('WS-Fed - SP.initSSO: Accessing WS-Fed SP initSSO script');
 
 if (!$config->getBoolean('enable.wsfed-sp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 if (empty($_GET['RelayState'])) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NORELAYSTATE');
+	throw new SimpleSAML_Error_Error('NORELAYSTATE');
 }
 
 try {
@@ -32,7 +31,7 @@ try {
 	$spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID('wsfed-sp-hosted');
 
 } catch (Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
+	throw new SimpleSAML_Error_Error('METADATA', $exception);
 }
 
 if ($idpentityid == null) {
@@ -60,7 +59,7 @@ try {
 		));
 	
 } catch (Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'CREATEREQUEST', $exception);
+	throw new SimpleSAML_Error_Error('CREATEREQUEST', $exception);
 }
 
 ?>
\ No newline at end of file
diff --git a/www/wsfed/sp/prp.php b/www/wsfed/sp/prp.php
index be7f77280285d667987871fbad3c6518f3eef6e6..37acae025163fcd051e9a1fd22e7a014c5ad9152 100644
--- a/www/wsfed/sp/prp.php
+++ b/www/wsfed/sp/prp.php
@@ -21,7 +21,7 @@ $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 SimpleSAML_Logger::info('WS-Fed - SP.AssertionConsumerService: Accessing WS-Fed SP endpoint AssertionConsumerService');
 
 if (!$config->getBoolean('enable.wsfed-sp', false))
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS');
+	throw new SimpleSAML_Error_Error('NOACCESS');
 
 if (!empty($_GET['wa']) and ($_GET['wa'] == 'wsignoutcleanup1.0')) {
 	print 'Logged Out';
@@ -40,7 +40,7 @@ try {
 		throw new Exception('Missing wctx parameter');
 	}
 } catch(Exception $exception) {
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'ACSPARAMS', $exception);
+	throw new SimpleSAML_Error_Error('ACSPARAMS', $exception);
 }
 
 
@@ -143,7 +143,7 @@ try {
 	SimpleSAML_Utilities::redirect($wctx);
 
 } catch(Exception $exception) {		
-	SimpleSAML_Utilities::fatalError($session->getTrackID(), 'PROCESSASSERTION', $exception);
+	throw new SimpleSAML_Error_Error('PROCESSASSERTION', $exception);
 }
 
 ?>
\ No newline at end of file