PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, June 25, 2022

[FIXED] what is the diffrence between error and exception

 June 25, 2022     compiler-errors, exception, mysql, runtime-error, sql     No comments   

Issue

when i search this on google then it show that error means compile time error and exception is runtime error? but i think that it is not that so....


Solution

That is generally correct. Although the terms are colloquially interchangeable in many domains.

An Error, also known as a compile-time error, is a statement of fact. (Or NOT fact) The compiler is unable to compile the output.

  • Technically an error is a state in code that has raised an exception in the compiler's runtime :)

An Exception is raised at runtime and is the result of an exceptional combination of values.

Because an Exception is raised at runtime, we can generally write code to catch and handle or workaround an exception within your script or code. An Error prevents the code from being compiled and thus executed at all, so our only option is to modify the code to resolve an Error.

A compiler may perform syntax and sometimes type checking to ensure that the code follows a set of pre-determined rules and can be compiled into executable statements, but it is not until invalid values are passed into those statements that an Exception can occur, that is harder for a compiler to do and so is generally only detected at Runtime.

Some advanced or specialised compilers may perform checks against common values and as a programer you can write unit tests to try and pre-emptively detect exceptions before releasing your code.



Answered By - Chris Schaller
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing