[mapguide-users] MgAuthenticationFailedException raised when should be caught

Jason Birch Jason.Birch at nanaimo.ca
Wed Apr 22 11:44:13 EDT 2009


Assuming that you're including constants.php/common.php, the code looks fine.  Care to try mine (attached, and works for me on 2.0.2/IIS/PHP)?  You may have to adjust the paths to the PHP includes.

FYI, if the user doesn't exist, you'll get a different exception (MgUserNotFoundException).  I usually catch the generic MgException and if necessary deal with the type of exception by comparing against get_class($e).

Jason

-----Original Message-----
From: dorshemer
Sent: April-22-09 6:11 AM
Subject: [mapguide-users] MgAuthenticationFailedException raised when should be caught

I'm getting this error: 
Fatal error: Uncaught exception 'mgauthenticationfailedexception' in Unknown
-------------- next part --------------
<?php
header("Content-type: text/plain");
require("../mapviewerphp/constants.php");
require("../mapviewerphp/common.php");
try 
{
	InitializeWebTier();	
	$userInfo = new MgUserInformation("Administrator", "fred");
	$siteConnection = new MgSiteConnection();
	$siteConnection->Open($userInfo);
} 
catch (MgAuthenticationFailedException $e) 
{
	print "Caught Exception Properly\n\n" . get_class($e);
} 
catch (MgException $e) 
{
	print "Didn't catch!\n\n" . get_class($e);
}
?>


More information about the mapguide-users mailing list