Error code
An error code is a symbolic or numeric value that identifies or classifies an error or failure condition.
Functional Programming in Scala, Second Edition
An error code is a returned value that indicates an exceptional or failed condition instead of transferring control by throwing an exception.
- How it is used
- Contrasts returned failure indicators with exceptions while motivating typed, composable error handling.
- How deep it goes
- Explains propagation risks, call-site boilerplate, polymorphic limitations, and typed alternatives without implementing the generic type.
- Examples
- Uses C-style return codes, failing functions, and the empty-sequence mean problem to contrast failure-handling policies.
- What you can do after
- Evaluate error-code designs against silent propagation, boilerplate, polymorphism, and caller-policy costs.
Read how Functional Programming in Scala, Second Edition explains error code →
Systems Programming with Zig
An error code is a value returned or stored to indicate that an operation failed and often identify the failure kind.
- How it is used
- Reports failure kinds across a C-facing interface and makes failures easier to investigate than a null result.
- How deep it goes
- Works through integer-backed codes, Zig error translation, and out parameters, then contrasts GLFW error queries and callbacks.
- Examples
- Uses recipe creation, checked Fibonacci input, and GLFW initialization to demonstrate different error-reporting paths.
- What you can do after
- Apply error-code translation in Zig when exposing operations to C callers, and inspect GLFW failures by query or callback.
100 C++ Mistakes and How to Avoid Them
An error return code is a value returned by a function to indicate that an operation encountered an error condition.
- How it is used
- Distinguishes error-return signaling from exceptions when discussing how functions and constructors handle failure.
- How deep it goes
- Defines sentinel values, value selection and caller checks, then contrasts exceptions; does not provide an error-code implementation.
- Examples
- Contrasts return codes with a constructor that rejects a negative age by throwing an exception.
- What you can do after
- Evaluate whether sentinel choices and caller checks make an error-return scheme ambiguous.
Read how 100 C++ Mistakes and How to Avoid Them explains error code →
Also covered in
- API Design Patterns
- Embedded Software with RustIn early access (MEAP)
- gRPC Microservices in Go
- JavaScript in DepthIn early access (MEAP)
- Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
- The Design of Web APIs, Second Edition
What to know first
- C++C++ is a statically typed, general-purpose programming language that supports procedural, object-oriented, generic, and low-level systems programming.
- atomic typeAn atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- exceptionAn exception is a runtime signal or value representing an abnormal condition that interrupts ordinary program flow and can be handled or propagated.
- integerAn integer is a whole-number mathematical value, including negative numbers, zero, and positive numbers, with no fractional part.
Related concepts
- sentinel valuekind of · A sentinel value is a distinguished value that signals a special condition or control state rather than representing ordinary data.
- exceptioncontrasts with · An exception is a runtime signal or value representing an abnormal condition that interrupts ordinary program flow and can be handled or propagated.
- error handlingused by · Error handling is the practice of detecting, representing, propagating, and responding to failures that arise during software execution or operation.
- error messagecontrasts with · An error message is textual diagnostic information that communicates a problem or failure detected or encountered by software or a computing system.
Questions about error code
What is error code?
An error code is a symbolic or numeric value that identifies or classifies an error or failure condition.
Which Manning books explain error code?
Functional Programming in Scala, Second Edition, Systems Programming with Zig and 100 C++ Mistakes and How to Avoid Them.
What should I know before learning error code?
Manning books that teach error code usually introduce C++, atomic type, exception and integer first.
What is the difference between error code and optional pointer?
An error code is a symbolic or numeric value that identifies or classifies an error or failure condition. An optional pointer is a pointer value type that can represent either a valid address or no address.
What is error code a kind of?
Error code is a kind of sentinel value. A sentinel value is a distinguished value that signals a special condition or control state rather than representing ordinary data.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


