Error code: Difference between revisions

Content deleted Content added
m Reverted edits by 2401:4900:53D7:5D90:0:0:1236:94B4 (talk) (HG) (3.4.12)
m General cleanup. See also: Alphabetize per MOS:SEEALSO. External links: Rm dead external links per WP:ELDEAD.
Line 1:
{{Short description|Code that indicates the nature of an error}}
{{distinguish|Error correction code}}
 
In [[computing]], an '''error code''' (or a '''return code)''' is a numeric or [[Alphanumericals|alphanumeric]] code that indicates 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> Error codes can be reported to end users of software, returned from [[Communication protocol|communication protocols]], or used within programs as a method of representing anomalous conditions.
 
== 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]], indicating 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 are commonly encountered on displays of consumer electronics to users in order to communicate or specify an error. 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.
 
Line 17 ⟶ 19:
 
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:
* [[Linux]] defines its own [[errno.h]] header file, containing the meanings and values of error codes returned by [[System call|system calls]] and library functions.<ref>{{Cite web |title=errno(3) - Linux manual page |url=https://www.man7.org/linux/man-pages/man3/errno.3.html |access-date=2023-03-12 |website=www.man7Man7.org}}</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 |last=Passing |first=Johannes |title=Error Codes: Win32 vs. HRESULT vs. NTSTATUS |url=https://jpassing.com/2007/08/20/error-codes-win32-vs-hresult-vs-ntstatus/ |access-date=2023-03-12 |website=jpassing.com |language=en}}</ref><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 |language=en-us}}</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 |language=en-us}}</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>
* [[Linux]] defines its own [[errno.h]] header file, containing the meanings and values of error codes returned by [[System call|system calls]] and library functions.<ref>{{Cite web |title=errno(3) - Linux manual page |url=https://www.man7.org/linux/man-pages/man3/errno.3.html |access-date=2023-03-12 |website=www.man7.org}}</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 |last=Passing |first=Johannes |title=Error Codes: Win32 vs. HRESULT vs. NTSTATUS |url=https://jpassing.com/2007/08/20/error-codes-win32-vs-hresult-vs-ntstatus/ |access-date=2023-03-12 |website=jpassing.com |language=en}}</ref><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 |language=en-us}}</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 |language=en-us}}</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|Communication protocols]]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.
 
[[Communication protocol|Communication protocols]] 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:
Line 33:
 
== In automobiles ==
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.{{cnCitation needed|date=April 2023}}
 
In [[vehicle]]s with [[CAN bus|CAN buses]]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).{{cnCitation needed|date=April 2023}}
 
==See also==
* [[errno.h]], a header file in C that defines macros for reporting errors
* [[HRESULT]], a computer programming [[data type]] used for error codes
* [[Abort (computing)]]
* [[Aspect-oriented programming]]
* [[FailureBlue Screen of Death]]
* [[errno.h]], a header file in C that defines macros for reporting errors
* [[Exit status]]
* [[Failure]]
* [[HRESULT]], a computer programming [[data type]] used for error codes
* [[Static code analysis]]
* [[Blue Screen of Death]]
 
==References==
Line 51:
 
==External links==
* [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://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx Microsoft system error codes]
* [http://support.microsoft.com/kb/310123 Microsoft Device Manager error codes]