Error code: Difference between revisions

Content deleted Content added
Added a reference
Undid revision 1283414520 by 2600:387:9:5:0:0:0:72 (talk) unexplained removal of relevant wikilink
 
(123 intermediate revisions by 84 users not shown)
Line 1:
{{Short description|Code that indicates the nature of an error}}
{{distinguishDistinguish|Error correction code}}
{{merge to|Exit status|date=April 2019}}
 
{{unreferenced|date=August 2012}}
In [[Programming language|computer programmingcomputing]], aan '''returnerror code''' (or ana '''errorreturn code''') is a numberednumeric or [[Alphanumericals|alphanumeric]] code that is used to determineindicates the nature of an error, and, when possible, why it occurred.<ref>{{Cite web|url=https://www.computerhope.com/jargon/e/errorcode.htm|title=What is an Error Code?|website=www.computerhopeComputerHope.com|language=en |access-date=2020-01-22}}</ref> InError C programming youcodes can findbe many error codes defined under the header file <error.h>. They are also commonly found in consumer electronics and devices when these attemptreported to doend somethingusers itof can'tsoftware, doreturned (ie,from [[DivisionCommunication by zeroprotocol|dividing bycommunication zeroprotocols]])., or Theyused canwithin alsoprograms passedas offa tomethod errorof handlersrepresenting that determine what action toanomalous takeconditions.
 
== In consumer products ==
[[File:Error-code-e74.jpg|thumb|upright=1.3|alt=The error code E74. Above the large E 74 code is the message "System Error. Contact Xbox Customer Support." repeated in different languages.|thumb|Error E74 on the [[Xbox 360]], symbolizingindicating a hardware failure<ref>{{Cite web |title=Xbox Support |url=https://support.xbox.com/en-US/help/errors/xbox-360/error-code-e74 |access-date=2023-03-12 |website=support.xbox.com}}</ref>]]
Error codes can also be used to specify an error, and simplify research into the cause and how to fix it. This is commonly used by consumer products when something goes wrong, such as the cause of a [[Blue Screen of Death]], to make it easier to pinpoint the exact problem the product is having.
 
Error codes are commonly encountered on displays of consumer electronics to users in order to communicate or specify an error. They can also be indicated by lights or beeps, e.g., if a device does not have a display. They are commonly reported by consumer electronics when users bring electronics to perform tasks that they cannot do (e.g., [[Division by zero|dividing by zero]]), or when the program within a device encounters an anomalous condition.
There is no definitive form of an error code. Some styles use decimal or hexidecimal numbers. Others use alphanumeric codes, while others use a phrase describing the error.
 
Error codes reported by consumer electronics are used to help diagnose and repair technical problems. An error code can be communicated to relevant support staff to identify potential fixes, or can simplify research into the cause of an error.
== In computing ==
Error codes in computers can be passed to the system itself, to judge how to respond to the error. Often error codes come synonymous with an exit code or a return value.
 
There is no definitive format for error codes, meaning that error codes typically differ from/between products and or companies.
==In networking software==
 
== In computer programming ==
[[Network protocol]]s typically support returning status codes. In the [[TCP/IP stack]], it's a common feature of higher level protocols. For example:
Error codes in computers can be passed to the system itself, to judge how to respond to the error. Often error codes come synonymous with an [[Exit status|exit code]] or a return value. The system may also choose to pass the error code to its user(s). The [[Blue screen of death]] is an example of how the [[Microsoft Windows|Windows operating system]] communicates error codes to the user.
 
Error codes can be used within a computer program to represent an anomalous condition. A computer program can take different actions depending on the value of an error code.
 
Different programming languages, operating systems, and programming environments often have their own conventions and standards for the meanings and values of error codes. Examples include:
* [[Unix-like]] systems have an [[errno.h]] header file that contains the meanings and values of error codes returned by [[system call]]s and library functions.<ref>{{man|2|intro|v7}}</ref><ref>{{man|3|errno|Linux}}</ref><ref>{{man|2|intro|Solaris}}</ref>
* [[Windows API|Microsoft Windows' application programming interfaces (APIs)]] have several different standards for error code values, depending on the specific API being used.<ref>{{Cite web |title=[MS-ERREF]: Overview |url=https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/774ca55e-5e94-49ad-8710-c777fc717599 |access-date=2023-03-12 |website=learn.microsoft.com |date=30 March 2020 }}</ref>
 
The usage of error codes as an error handling strategy is often contrasted against using [[Exception handling|exceptions]] for error handling.<ref>{{Cite web |last=TylerMSFT |title=Modern C++ best practices for exceptions and error handling |url=https://learn.microsoft.com/en-us/cpp/cpp/errors-and-exception-handling-modern-cpp |access-date=2023-03-12 |website=Learn.Microsoft.com |date=17 October 2022 }}</ref><ref>{{Cite web |title=Standard C++ |url=https://isocpp.org/wiki/faq/exceptions#exceptions-avoid-spreading-out-error-logic |access-date=2023-03-12 |website=IsoCpp.org }}</ref>
 
==In communication protocols==
[[Communication protocol]]s typically define a standard set of error codes, as a means of communicating the status or result of an operation between the entities in the system.
 
Several high-level protocols in the [[TCP/IP stack]], such as [[HTTP]], [[File Transfer Protocol|FTP]], and [[Simple Mail Transfer Protocol|SMTP]], define their own standard sets of error codes:
* [[List of HTTP status codes]]
* [[List of FTP server return codes]]
* [[{{Section link|Simple Mail Transfer Protocol#Protocol overview]]}}
 
== In automobiles ==
==Error codes and exception handling==
Error codes in automobiles, sometimes referred to as trouble codes, indicate to a driver or car mechanic what is wrong with a vehicle before repairs are initiated.{{Citation needed|date=April 2023}}
Error codes are passed to [[exception handling]] in programming languages that support it. These are passed to log files and the parent process to determine what action to take.
 
In [[vehicle]]s with [[CAN bus]]es, error codes are often five-digit codes that pinpoint a particular car fault. Car owners can make use of an [[on-board diagnostics]] scanner or an owner's manual to identify the meaning of a trouble code. Five-digit diagnostic trouble codes typically consist of one letter and four numbers (e.g. P0123).{{Citation needed|date=April 2023}}
 
==See also==
==* In[[Abort (computing ==)]]
* [[Aspect-oriented programming]]
* [[Blue Screen of Death]]
* [[errno.h]], a header file in C that defines macros for reporting errors
* [[AbortExit (computing)status]]
* [[Failure]]
*[[Aspect-oriented programming]]
* [[HRESULT]], a computer programming [[data type]] used for error codes
*[[Failure]]
* [[ExitStatic code statusanalysis]]
 
*[[Static code analysis]]
==References==
{{Reflist}}
 
==External links==
* [http://supportmsdn.microsoft.com/kben-us/310123library/ms681381(VS.85).aspx Microsoft Device Managersystem error codes]
*[https://web.archive.org/web/20110115230351/http://www.barricane.com/c-error-codes-include-errno Lists of Linux errno values, both numeric and symbolic]
* [http://msdnsupport.microsoft.com/en-uskb/library/ms681381(VS.85).aspx310123 Microsoft systemDevice Manager error codes]
*[http://support.microsoft.com/kb/310123 Microsoft Device Manager error codes]
 
[[Category:Software]]