Use try+catch: http://www.php.net/manual/en/language.exceptions.php
> -----Ursprüngliche Nachricht----- > Von: [email protected] > [mailto:[email protected]] Im Auftrag von kaaos > Gesendet: Montag, 12. Dezember 2011 22:30 > An: [email protected] > Betreff: [mapserver-users] small mapserver admin tool errors > > Hi. > > Im writing a small admin tool for MapServer for own use in PHP with > MapScript. > > I'm building a mapfile object with ms_newMapObj() and then > throwing elements > > into database, forms, etc. > > I've got this problem that when a mapfile has errors (pure > simple like > > 'IMAGETYPE "pnhgg"' instead 'IMAGETYPE "png"') the mapscript > parser throws > an > > error and the whole application stops. > > The thing is that I want the application on to at least tell > the user, that > his > > mapfile has errors and for example open a textarea where the > user could edit > his > > whole mapfile without throwing it to ms_newMapObj(). > > I tried many things but nothing seems to work. The thing is, it's > > msPostMapParseOutputFormatSetup() which actually crashes and > which is used > by > > ms_newMapObj(). I dont have access to > msPostMapParseOutputFormatSetup(). > > > Sample: > > > A PHP Error was encountered > Severity: Warning > Message: ms_newMapObj(): [MapServer Error]: > msPostMapParseOutputFormatSetup(): > > Unable to select IMAGETYPE `pnfg'. > Filename: controllers/program.php > Line Number: 35 > > Fatal error: Uncaught exception 'MapScriptException' with > message 'Failed to > > open map file "D:\ms4w\Apache\htdocs\p3\p3.map"' in > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\program.php:35 > > Stack trace: #0 > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\program.php(35) > > : ms_newMapObj('D:\ms4w\Apache\...') #1 > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\program.php(10) > > : Program->index() #2 [internal function]: Program->save_f_tmp() #3 > > D:\ms4w\Apache\htdocs\ci_doctrine\system\codeigniter\CodeIgnit > er.php(236): > > call_user_func_array(Array, Array) #4 > > D:\ms4w\Apache\htdocs\ci_doctrine\index.php(115): > > require_once('D:\ms4w\Apache\...') #5 {main} thrown in > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\program.php > on > > line 35 > > Fatal error: Uncaught exception 'MapScriptException' with > message 'Failed to > > open map file "D:\ms4w\Apache\htdocs\map_file\map_file.map"' in > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\load_controler. > > php:35 Stack trace: #0 > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\load_controler. > > php(35): ms_newMapObj('D:\ms4w\Apache\...') #1 > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\load_controler. > > php(10): Program->index() #2 [internal function]: Program->svft() #3 > > D:\ms4w\Apache\htdocs\ci_doctrine\system\codeigniter\CodeIgnit > er.php(236): > > call_user_func_array(Array, Array) #4 > > D:\ms4w\Apache\htdocs\ci_doctrine\index.php(115): > > require_once('D:\ms4w\Apache\...') #5 {main} thrown in > > D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle > rs\load_controler. > > php on line 35 > > Thanks for any help. > > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/small-mapserver-admin-t > ool-errors-tp7087821p7087821.html > Sent from the Mapserver - User mailing list archive at Nabble.com. > _______________________________________________ > mapserver-users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/mapserver-users > _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
