polkadot-api / polkadot-api-docs

Docs for polkadot-api
https://papi.how
2 stars 6 forks source link

Document errors usage #25

Open mutantcornholio opened 2 months ago

mutantcornholio commented 2 months ago

I have no idea now to use errors that papi generates...

It's mentioned in codegen part but not alongside other generated APIs, like constants

I see you can import the type, like this:

import { WestendErrors } from "@polkadot-api/descriptors";
// and probably do something like 
const error: WestendErrors["Preimage"]["NotNoted"] = undefined;

But how do you actually get instances of these errors and match them in runtime?