docs(contracts): use gl.vm.UserError, gl.UserError does not exist - #516
docs(contracts): use gl.vm.UserError, gl.UserError does not exist#516kriss39 wants to merge 1 commit into
Conversation
✅ Deploy Preview for genlayer-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe documentation updates Python examples to use ChangesError namespace documentation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Other Merge Risk: ⚪ Minimal · up to The examples now reference the correct error namespace, with no concrete merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Seven snippets across three pages
raise gl.UserError(...)/except gl.UserError. Neither GenVM std library exportsUserErrorat thegllevel — the class isgl.vm.UserError:genlayer/gl/__init__.pyhas noUserErrorin__all__, and its lazy__getattr__raisesAttributeError: module 'genlayer.gl' has no attribute 'UserError'; the class isgenlayer/gl/vm.py.genlayer/__init__.pylikewise; the class isgenlayer/vm/__init__.py:156.error-handling.mdxalready usesgl.vm.UserErrorcorrectly in its other snippets (lines 30, 54, 58, 69, 74), so this only makes the remaining seven lines consistent.Copying any of these snippets into a contract turns the intended
UserError(a recoverable contract error) into anAttributeErroron theraiseline itself, i.e. an unrecoverable VM exit.Change
pages/developers/intelligent-contracts/features/calling-llms.mdx(4 lines)pages/developers/intelligent-contracts/features/web-access.mdx(2 lines)pages/developers/intelligent-contracts/features/error-handling.mdx(1 line)s/gl\.UserError/gl.vm.UserError/only; no other edits.Verification
GENERATING_DOCS=true:gl.UserError→AttributeError,gl.vm.UserError→ OK (v0.2.16 and v0.3.x).python3 scripts/lint-code-examples.py: all 99 snippets still parse; the 24 reported issues are identical tomain(pre-existing, unrelated pages).grep -rn "gl\.UserError" pages→ 0 after the change.Note: open PR #423 (ContractRollback → UserError) introduces the same
gl.UserErrorspelling inapi-references/genlayer-test/direct.md; it would want thegl.vm.prefix too.Summary by CodeRabbit
gl.vm.UserErrorsyntax.