IfElseFallbackCalled
Event v320 → current #7Emitted when the main call failed and fallback was executed.
View events on chainUseful for: developerswallets
The Big Picture
Main call failed, so fallback was executed.
Use Cases
- Track fallback execution
From Chain Metadata
The fallback call was dispatched.
Triggers
Emitted by
Preconditions
- if_else executed
- Main failed
Effects
Postconditions
- Fallback executed
Side Effects
- Main error available
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | main_error | DispatchError | Error from the main call that triggered fallback |
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Subscribe to IfElseFallbackCalled events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("Utility") &&
event.method === "IfElseFallbackCalled"
)
.forEach(({ event }) => {
console.log("IfElseFallbackCalled:", event.data.toHuman());
});
});Runtime Info
- Pallet Index
- 11
- Event Index
- 7
- First Version
- v320
- Current Version
- v393