Sha256: bc282feba1fc31cf896f0a8df45dc4b278507d147451f03174716f8c4630ff82

Contents?: true

Size: 1.01 KB

Versions: 93

Compression:

Stored size: 1.01 KB

Contents

---
layout: page
title: Polyphony::BaseException
parent: API Reference
permalink: /api-reference/polyphony-baseexception/
---
# Polyphony::BaseException

The `Polyphony::BaseException` is a common base class for exceptions used to
control fiber execution. Instances of descendant classes are meant to be created
explicitly using `new`, e.g. `Polyphony::MoveOn.new`, rather than using `raise
Polyphony::MoveOn`. Normally an application will not use those classes directly
but would rather use APIs such as `Fiber#interrupt`.

## Derived classes

- [`Polyphony::Cancel`](../polyphony-cancel/)
- [`Polyphony::MoveOn`](../polyphony-moveon/)
- [`Polyphony::Restart`](../polyphony-restart/)
- [`Polyphony::Terminate`](../polyphony-terminate/)

## Instance methods

### #initialize(value = nil)

Initializes the exception with an optional result value. The value will be used
as the result of the block being interrupted or the fiber being terminated.

```ruby
f = spin { 'foo' }
f.raise(Polyphony::Terminate.new('bar'))
f.await #=> 'bar'
```

Version data entries

93 entries across 93 versions & 1 rubygems

Version Path
polyphony-0.99 docs/api-reference/polyphony-baseexception.md
polyphony-0.98 docs/api-reference/polyphony-baseexception.md
polyphony-0.97 docs/api-reference/polyphony-baseexception.md
polyphony-0.96 docs/api-reference/polyphony-baseexception.md
polyphony-0.95 docs/api-reference/polyphony-baseexception.md
polyphony-0.94 docs/api-reference/polyphony-baseexception.md
polyphony-0.93 docs/api-reference/polyphony-baseexception.md
polyphony-0.92 docs/api-reference/polyphony-baseexception.md
polyphony-0.91 docs/api-reference/polyphony-baseexception.md
polyphony-0.90 docs/api-reference/polyphony-baseexception.md
polyphony-0.89 docs/api-reference/polyphony-baseexception.md
polyphony-0.87 docs/api-reference/polyphony-baseexception.md
polyphony-0.86 docs/api-reference/polyphony-baseexception.md
polyphony-0.85 docs/api-reference/polyphony-baseexception.md
polyphony-0.84.1 docs/api-reference/polyphony-baseexception.md
polyphony-0.84 docs/api-reference/polyphony-baseexception.md
polyphony-0.83 docs/api-reference/polyphony-baseexception.md
polyphony-0.82 docs/api-reference/polyphony-baseexception.md
polyphony-0.81.1 docs/api-reference/polyphony-baseexception.md
polyphony-0.81 docs/api-reference/polyphony-baseexception.md