Skip to Main Content
Secure Development for Mobile Apps
book

Secure Development for Mobile Apps

by J. D. Glaser
October 2014
Intermediate to advanced content levelIntermediate to advanced
472 pages
10h 44m
English
Auerbach Publications
Content preview from Secure Development for Mobile Apps
175
ProFessIonAl exCePtIon And error HAndlIng
To configure error conversion to ErrorExceptions, implement set_error_
handler() like this.
fu nction convertToException($errNo, $errStr, $errFile, $errLine,
$errContext)
{
if (error_reporting() = = 0) return;
thr ow new ErrorException($errStr, 0, $errNo, $errFile,
$errLine);
}
set_error_handler('convertToException');
Now, PHP errors are converted to exceptions and rethrown as ErrorException
objects, allowing them to be caught by catch handlers. is facilitates designing a
consistent error handling structure for an application.
Note that the function signature for the handler must be exactly as specified.
Following is an excerpt from the online PHP Manual:
Error Handler Function Specification
A callback w ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Developing with Web Standards

Developing with Web Standards

John Allsopp
Mobile Cloud Computing

Mobile Cloud Computing

Dijiang Huang, Huijun Wu

Publisher Resources

ISBN: 9781482209037