-
Notifications
You must be signed in to change notification settings - Fork 550
feat: Add RestException export to main twilio package with examples and documentation #1110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add RestException export to main twilio package with examples and documentation #1110
Conversation
Co-authored-by: manisha1997 <[email protected]>
|
@copilot update examples/example.js to catch rest exception. Also add the usage examples in readme for both commonjs and esm. |
Co-authored-by: tiwarishubham635 <[email protected]>
Done! I've updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the example and readme snippets. Working fine. LGTM!
|
Fixes #1105 by adding
RestException
to the main package exports, allowing developers to import it directly from 'twilio' instead of using deep imports, and provides comprehensive examples and documentation.Problem
Previously, developers had to use deep imports to access
RestException
:This caused issues with modern TypeScript configurations and wasn't intuitive for developers who expected to import it from the main package like other Twilio components.
Solution
Added
RestException
to the main package exports following the same pattern used by other components likeRequestClient
, and provided comprehensive examples showing how to use it effectively.Changes
RestException
import tosrc/index.ts
TwilioSDK
namespaceexamples/example.js
to demonstrate proper RestException handling in both callback and promise patternsUsage Examples
Error Handling with ESM:
Error Handling with CommonJS:
Validation
This change provides a significantly better developer experience with proper documentation and examples while maintaining backward compatibility and following the library's existing conventions.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.