Throw
A throw construct explicitly raises or propagates an exception, error, or value to transfer control nonlocally from normal execution.
100 SQL Server Mistakes and How to Avoid Them
THROW is a SQL Server statement that rethrows an original exception or raises a specified ad hoc error.
- How it is used
- Surfaces meaningful failures after errors are trapped in SQL Server error-handling paths.
- How deep it goes
- Positions THROW within TRY..CATCH and transaction cleanup, without detailing its syntax or rethrow semantics.
- Examples
- Uses a renamed sales-order detail table and invalid product IDs to produce transactional database errors.
- What you can do after
- Apply it via T-SQL to raise meaningful errors after handling failures in transactional code.
Read how 100 SQL Server Mistakes and How to Avoid Them explains throw →
The Joy of JavaScript
A throw expression is an expression form that raises an exception from within an expression context.
- How it is used
- Uses throw expressions to make validation and other error-handling paths composable inside expression-oriented JavaScript code.
- How deep it goes
- Explains the proposal’s rationale and supported expression contexts, but defers detailed enablement instructions to an appendix.
- Examples
- Demonstrates a missing-block error through a proof-of-work function’s default parameter.
- What you can do after
- Evaluate how proposed throw expressions reduce wrapper functions and blocks when raising exceptions from expression contexts.
Practical Automation with PowerShell: Effective scripting from the console to the cloud
A throw statement generates an exception or terminating error that interrupts normal PowerShell execution.
- How it is used
- Guards automation preconditions and reports unrecoverable failures such as duplicate archive paths or timed-out processes.
- How deep it goes
- Explains terminating control flow, `try`/`catch` handling, `-ErrorAction Stop`, error inspection, and re-throwing rather than language internals.
- Examples
- Uses duplicate archive-file detection, missing-service handling, and a timed-out `ping.exe` process.
- What you can do after
- Apply it to halt unsafe automations, route terminating failures through `catch`, and signal external-process timeouts.
Related concepts
- non-local returnaddresses · A non-local return is a control-flow transfer that exits an enclosing function or computation from within nested code.
- exceptionkind of · An exception is a runtime signal or object representing an abnormal condition that interrupts ordinary program flow and may be handled or propagated.
- RAISERRORalternative to · RAISERROR is a SQL Server statement or function for generating an error message with specified error information and severity behavior.
- async iterableused by · An async iterable is an object that produces a sequence of values asynchronously through an asynchronous iteration protocol.
- return statementcontrasts with · A return statement ends the current function or routine invocation and optionally supplies its result to the caller.
- terminating errorproduces · A terminating error is an execution error that stops the current PowerShell operation or script unless it is handled.
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.


