From 382b313a73b7f306b3e4cb2921b13a68b8111b24 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 20 Dec 2024 13:31:51 -0800 Subject: [PATCH] Scrub Soroban "Status" terminology, it has been "Error" for a while. --- docs/build/guides/conventions/error-enum.mdx | 4 ++-- .../example-contracts/errors.mdx | 18 +++++++++--------- .../contract-interactions/overview.mdx | 4 ++-- .../errors-and-debugging/debugging.mdx | 2 +- .../errors-and-debugging/errors.mdx | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/build/guides/conventions/error-enum.mdx b/docs/build/guides/conventions/error-enum.mdx index 1a96aae23..fefb169af 100644 --- a/docs/build/guides/conventions/error-enum.mdx +++ b/docs/build/guides/conventions/error-enum.mdx @@ -34,8 +34,8 @@ impl Contract { } ``` -When converted to XDR, the value becomes an `ScVal`, containing a `ScStatus`, containing the integer value of the error as contract error. +When converted to XDR, the value becomes an `ScVal`, containing a `ScError`, containing the integer value of the error as contract error. ```json -{ "status": { "contractError": 1 } } +{ "error": { "contractError": 1 } } ``` diff --git a/docs/build/smart-contracts/example-contracts/errors.mdx b/docs/build/smart-contracts/example-contracts/errors.mdx index 234a34c44..7e81958dd 100644 --- a/docs/build/smart-contracts/example-contracts/errors.mdx +++ b/docs/build/smart-contracts/example-contracts/errors.mdx @@ -59,15 +59,15 @@ count: U32(2) count: U32(3) count: U32(4) count: U32(5) -Status(ContractError(1)) -contract call invocation resulted in error Status(ContractError(1)) +Error(ContractError(1)) +contract call invocation resulted in error Error(ContractError(1)) test test::test ... ok thread 'test::test_panic' panicked at 'called `Result::unwrap()` on an `Err` value: HostError -Value: Status(ContractError(1)) +Value: Error(ContractError(1)) Debug events (newest first): - 0: "Status(ContractError(1))" + 0: "Error(ContractError(1))" 1: "count: U32(5)" 2: "count: U32(4)" 3: "count: U32(3)" @@ -219,7 +219,7 @@ fn test() { } #[test] -#[should_panic(expected = "Status(ContractError(1))")] +#[should_panic(expected = "Error(ContractError(1))")] #E3256B fn test_panic() { let env = Env::default(); @@ -257,7 +257,7 @@ Two functions are generated for every contract function, one that returns a `Res ### `try_increment` -In the first test the `try_increment` function is called and returns `Result, Result>`. +In the first test the `try_increment` function is called and returns `Result, Result>`. ```rust assert_eq!(client.try_increment(), Ok(Ok(5))); @@ -268,13 +268,13 @@ assert_eq!(client.try_increment(), Err(Ok(Error::LimitReached))); - If the function call is successful but returns a value that is not a `u32`, `Ok(Err(_))` is returned. -- If the function call is unsuccessful, `Err(Ok(Error))` is returned. +- If the function call is unsuccessful and fails with an error in the `Error` enum, `Err(Ok(Error))` is returned. -- If the function call is unsuccessful but returns an error code not in the `Error` enum, or returns a system error code, `Err(Err(Status))` is returned and the `Status` can be inspected. +- If the function call is unsuccessful but returns an error code not in the `Error` enum, or returns a system error code, `Err(Err(InvokeError))` is returned and the `InvokeError` can be inspected. ### `increment` -In the second test the `increment` function is called and returns `u32`. When the last call is made the function panicks. +In the second test the `increment` function is called and returns `u32`. When the last call is made the function panics. ```rust assert_eq!(client.increment(), 5); diff --git a/docs/learn/encyclopedia/contract-development/contract-interactions/overview.mdx b/docs/learn/encyclopedia/contract-development/contract-interactions/overview.mdx index 1a718dd69..059a0e943 100644 --- a/docs/learn/encyclopedia/contract-development/contract-interactions/overview.mdx +++ b/docs/learn/encyclopedia/contract-development/contract-interactions/overview.mdx @@ -16,8 +16,8 @@ sidebar_position: 5 Contracts are invoked through a pair of host functions `call` and `try_call`: -- `try_call(contract, function, args)` calls `function` exported from `contract`, passing `args` and returning a `Status` on any error. -- `call(contract, function, args)` just calls `try_call` with its arguments and traps on `Status`, essentially propagating the error. +- `try_call(contract, function, args)` calls `function` exported from `contract`, passing `args` and returning a `Error` on any error. +- `call(contract, function, args)` just calls `try_call` with its arguments and traps on `Error`, essentially propagating the error. In both cases `contract` is a `Binary` host object containing the contract ID, `function` is a `Symbol` holding the name of an exported function to call, and `args` is a `Vector` of values to pass as arguments. diff --git a/docs/learn/encyclopedia/errors-and-debugging/debugging.mdx b/docs/learn/encyclopedia/errors-and-debugging/debugging.mdx index 5685a92ff..c29574159 100644 --- a/docs/learn/encyclopedia/errors-and-debugging/debugging.mdx +++ b/docs/learn/encyclopedia/errors-and-debugging/debugging.mdx @@ -53,4 +53,4 @@ While we encourage most testing to happen in local-testing mode, some problems w - A "sandbox" host with a mock-ledger that can read and write `CONTRACT_DATA` ledger entries to the local filesystem. - A general logging system that allows contracts to log values of the [shared host/guest "value" type](../contract-development/environment-concepts.mdx), even in production. -- User-extensible `Status` codes that can be returned from any contract call to indicate problems. +- User-extensible `Error` codes that can be returned from any contract call to indicate problems. diff --git a/docs/learn/encyclopedia/errors-and-debugging/errors.mdx b/docs/learn/encyclopedia/errors-and-debugging/errors.mdx index 6d08488c1..8b17e8f23 100644 --- a/docs/learn/encyclopedia/errors-and-debugging/errors.mdx +++ b/docs/learn/encyclopedia/errors-and-debugging/errors.mdx @@ -28,7 +28,7 @@ The [errors example] demonstrates how to define your own error types. ## Error Enums -Errors are a special type of enum integer type that are stored on ledger as `Status` values containing a `u32` code. +Errors are a special type of enum integer type that are stored on ledger as `Error` values containing a `u32` code. ```rust #[contracterror] @@ -39,8 +39,8 @@ pub enum Error { } ``` -When converted to XDR, the value becomes an `ScVal`, containing a `ScStatus`, containing the integer value of the error as contract error. +When converted to XDR, the value becomes an `ScVal`, containing a `ScError`, containing the integer value of the error as contract error. ```json -{ "status": { "contractError": 1 } } +{ "error": { "contractError": 1 } } ```