()
| 132 | |
| 133 | // Example with error handling |
| 134 | async function errorHandlingExample () { |
| 135 | console.log('\n=== Error Handling Example ===') |
| 136 | |
| 137 | try { |
| 138 | // Intentionally use a non-existent proxy |
| 139 | const socks5Proxy = new Socks5Agent('socks5://localhost:9999') |
| 140 | |
| 141 | await request('http://httpbin.org/ip', { |
| 142 | dispatcher: socks5Proxy |
| 143 | }) |
| 144 | } catch (error) { |
| 145 | console.log('Caught expected error:', error.message) |
| 146 | console.log('Error code:', error.code) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | // Global dispatcher example |
| 151 | async function globalDispatcherExample () { |
no test coverage detected