Total members 11890 |It is currently Fri Apr 19, 2024 11:53 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





There are seven main categories of error, presented here in descending order of importance: :Dash: :Dash: :Dash:
    Fatal error: Any HTML output preceding the error will be displayed, but once the error is encountered—as the name suggests—everything else is killed stone dead. A fatal error is normally caused by referring to a nonexistent file or function.
    Recoverable error: This type of error occurs only when a particular type of error known as an exception is thrown. The error message contains much detail, explaining the cause and location of the problem, but it can be difficult for beginners to understand. To avoid recoverable errors, use try and catch blocks as described in “Handling exceptions.”
    Parse error: This means there s a mistake in your code syntax, such as mismatched quotes or a missing semicolon or closing brace. It stops the script in its tracks, and it doesn t even allow any HTML output to be displayed.
    Warning: This alerts you to a serious problem, such as a missing include file. However, the error is not serious enough to prevent the rest of the script from being executed.
    Deprecated: Introduced in PHP 5.3.0, this warns you about features that are scheduled to be removed from the next major version of PHP. If you see this type of error message, you should seriously consider updating your script, as it could suddenly stop working if your server is upgraded.
    Strict: This type of error message warns you about using techniques that are not considered good practice.
    Notice: This advises you about relatively minor issues, such as the use of a non declared variable. Although this type of error won t stop your page from displaying (and you can turn off the display of notices), you should always try to eliminate them. Any error is a threat to your output.


Handling exceptions in PHP5

If you are a Java Programmer, you find this is little bit familiar. PHP5 use try and catch exception handling method.
When a problem arises, many built-in classes automatically throw an exception—or generate a special type of object that contains details of what caused the error and where it arose. You can also throw custom exceptions, using the keyword throw like this:
Code:
if ( error occurs ) {
throw new Exception('Houston, we have a problem');
}

Code:
try {
// main script goes here
} catch (Exception $e) {
echo $e->getMessage();
}




_________________
Coding my life with Java, PHP, JavaScript, and Python


Author:
Newbie
User avatar Posts: 39
Have thanks: 15 time

For this message the author isuru has received gratitude : DrRakha

@isuru

Great topic .

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Understanding PHP error messages
 Format Debugging Messages     -  
 Disabling Obtrusive Messages     -  
 Chat client and server, save messages and delete     -  
 ERROR     -  
 skymiles error     -  
 Deliberate Error     -  
 Check DNS error     -  
 error in code     -  
 Java error     -  
 error in inserting record     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com