-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GAPI-24749: Documentation update (add timeout, bulkhead, cache, and f…
…allback)
- Loading branch information
1 parent
689e8e7
commit ab6eb92
Showing
23 changed files
with
260 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ title: Mollitia - API - Circuit | |
--- | ||
|
||
Circuit | ||
|
||
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ title: Mollitia - API - Create a module | |
--- | ||
|
||
Create a module | ||
|
||
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ title: Mollitia - API - Create a plugin | |
--- | ||
|
||
Create a plugin | ||
|
||
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Mollitia - API - Module - Fallback | ||
--- | ||
# Fallback | ||
|
||
## Usage | ||
|
||
The `Fallback` module allows you to **filter** your errors. | ||
|
||
Works very well in conjunction with other modules! | ||
For example, filtering `Circuit Breaker` errors to return a generic error. | ||
|
||
``` javascript | ||
// Imports needed components | ||
const { Circuit, Fallback } = require('mollitia'); | ||
// Creates a circuit | ||
const circuit = new Circuit({ | ||
options: { | ||
modules: [ | ||
// Creates a fallback module | ||
new Mollitia.Fallback({ | ||
cb (err) { | ||
// Every time the method rejects, You can filter here | ||
if (err instanceof MyError) { | ||
// I know this error | ||
return err; | ||
} | ||
return new UnknownError(); | ||
} | ||
}) | ||
] | ||
} | ||
}); | ||
|
||
// The rejected errors are filtered, meaning you always know what is returned here | ||
circuit.fn(myFunction).execute() | ||
.catch((err) => { | ||
if (err instanceof MyError) { | ||
// It's a MyError error | ||
} else { | ||
// It's an UnknownError error | ||
} | ||
}); | ||
``` | ||
|
||
## Options | ||
|
||
| Name | Description | Default | | ||
|:-----|:-----------------------------------------------|:------------------| | ||
| `cb` | The callback, called when the circuit rejects. | `Function(Error)` | | ||
|
||
## Events | ||
|
||
| Name | Description | Params | | ||
|:-----------|:------------------------------------|:-------------------| | ||
| `execute` | Called when the module is executed. | `Mollitia.Circuit` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ title: Mollitia - API - Plugin - Prometheus | |
--- | ||
|
||
Prometheus | ||
|
||
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ title: Mollitia - Community - Modules | |
--- | ||
|
||
Modules | ||
|
||
<!-- TODO --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,3 @@ title: Mollitia - Community - Plugins | |
--- | ||
|
||
Plugins | ||
|
||
<!-- TODO --> |
Oops, something went wrong.