Skip to content

Commit

Permalink
docs: Fix broken links (#3176)
Browse files Browse the repository at this point in the history
  • Loading branch information
hetdagli234 committed Aug 18, 2024
1 parent 275b28a commit be80110
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ custom errors which the user (you!) can return.
- Custom Errors
- Non-anchor errors.

[AnchorErrors](https://docs.rs/anchor-lang/latest/anchor_lang/error/struct.AnchorError.html) provides a range of information like the error name and number or the location in the code where the error was thrown, or the account that violated a constraint (e.g. a `mut` constraint). Once thrown inside the program, [you can access the error information](https://coral-xyz.github.io/anchor/ts/classes/AnchorError.html) in the anchor clients like the typescript client. The typescript client also enriches the error with additional information about which program the error was thrown in and the CPI calls (which are explained [here](./cross-program-invocations) in the book) that led to the program from which the error was thrown from. [The milestone chapter](./milestone_project_tic-tac-toe.md) explores how all of this works together in practice. For now, let's look at how different errors can be returned from inside a program.
[AnchorErrors](https://docs.rs/anchor-lang/latest/anchor_lang/error/struct.AnchorError.html) provides a range of information like the error name and number or the location in the code where the error was thrown, or the account that violated a constraint (e.g. a `mut` constraint). Once thrown inside the program, [you can access the error information](https://coral-xyz.github.io/anchor/ts/classes/AnchorError.html) in the anchor clients like the typescript client. The typescript client also enriches the error with additional information about which program the error was thrown in and the CPI calls (which are explained [here](./cross-program-invocations) in the book) that led to the program from which the error was thrown from. [The milestone chapter](./tic-tac-toe) explores how all of this works together in practice. For now, let's look at how different errors can be returned from inside a program.

## Anchor Internal Errors

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/the-accounts-struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Add constraints to an account with the following format:
pub account: AccountType
```

Some constraints support custom Errors (we will explore errors [later](./errors.md)):
Some constraints support custom Errors (we will explore errors [later](./errors)):

```rust
#[account(...,<constraint> @ MyError::MyErrorVariant, ...)]
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/docs/tic-tac-toe.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Let us briefly explain how we arrived at the `Game::MAXIMUM_SIZE`. Anchor uses t

In addition to the game's size, we have to add another 8 to the space. This is space for the internal discriminator which anchor sets automatically. In short, the discriminator is how anchor can differentiate between different accounts of the same program. For more information, check out the Anchor space reference.

> [Anchor Space Reference](./../anchor_references/space.md)
> [Anchor Space Reference](./space)
> (What about using `mem::size_of<Game>()`? This almost works but not quite. The issue is that borsh will always serialize an option as 1 byte for the variant identifier and then additional x bytes for the content if it's Some. Rust uses null-pointer optimization to make Option's variant identifier 0 bytes when it can, so an option is sometimes just as big as its contents. This is the case with `Sign`. This means the `MAXIMUM_SIZE` could also be expressed as `mem::size_of<Game>() + 9`.)
Expand Down Expand Up @@ -340,7 +340,7 @@ The structure of the transaction function is as follows: First come the instruct
We did not have to specify the `system_program` account. This is because anchor recognizes this account and is able to infer it. This is also true for other known accounts such as the `token_program` or the `rent` sysvar account.

After the transaction returns, we can fetch the state of the game account. You can fetch account state using the `program.account` namespace.
Finally, we verify the game has been set up properly by comparing the actual state and the expected state. To learn how Anchor maps the Rust types to the js/ts types, check out the [Javascript Anchor Types Reference](./../anchor_references/javascript_anchor_types_reference.md).
Finally, we verify the game has been set up properly by comparing the actual state and the expected state. To learn how Anchor maps the Rust types to the js/ts types, check out the [Javascript Anchor Types Reference](./javascript-anchor-types).

Now, run `anchor test`. This starts up (and subsequently shuts down) a local validator (make sure you don't have one running before) and runs your tests using the test script defined in `Anchor.toml`.

Expand Down

0 comments on commit be80110

Please sign in to comment.