You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -61,22 +61,43 @@ let hint = HintFunc(Box::new(print_a_hint));
61
61
Import the BuiltinHintProcessor from cairo-vm, instantiate it using the `new_empty()` method and the add your custom hint implementation using the method `add_hint`
You can also create a dictionary of `Rc<HintFunc>` and use the method `new()` to create a `BuiltinHintProcessor` with a preset dictionary of functions instead of using `add_hint()` for each custom hint. Note that `new()` also requires a `RunResources` instance:
You can also create a dictionary of HintFunc and use the method `new()` to create a BuiltinHintProcessor with a preset dictionary of functions instead of using `add_hint()` for each custom hint.
69
79
70
80
#### Step 4: Run your cairo program using BuiltinHintProcessor extended with your hint
71
81
Import the function cairo_run from cairo-vm, and run your compiled program
@@ -125,11 +146,11 @@ There are also some helpers that dont depend on the hint processor used that can
125
146
You can also find plenty of example implementations in the [builtin hint processor folder](../../../vm/src/hint_processor/builtin_hint_processor).
126
147
127
148
### Error Handling
128
-
This API uses VirtualMachineError as error return type for hint functions, while its not possible to add error types to VirtualMachineError, you can use VirtualMachineError::CustomHint which receives a string and prints an error message with the format: "Hint Error: [your message]".
129
-
For example, if we want our hint to return an error if ids.a is less than 0 we could write:
149
+
This API uses `HintError` as error return type for hint functions. To return a custom error, use `HintError::CustomHint`, which receives a string and prints an error message with the format: "Hint Error: [your message]".
150
+
For example, if we want our hint to return an error if `ids.a` is less than 0 we could write:
0 commit comments