googleapis / gaxios

An HTTP request client that provides an axios like interface over top of node-fetch. Super lightweight. Supports proxies and all sorts of other stuff.
Apache License 2.0
797 stars 60 forks source link

feat!: Use `Error#cause` in `GaxiosError` #661

Closed danielbankhead closed 3 weeks ago

danielbankhead commented 1 month ago

Modern runtimes offer Error#cause - a standard way of defining the cause of another error.

This will also improving logging in some environments that handle cause in a special way.

Documentation:

Migration Guide

Use the cause property rather than error.

old:

const rootError = new GaxiosError().error;

new:

const rootError = new GaxiosError().cause;

Background

Dependencies (merge this PR after):

Fixes #572 🦕

generated-files-bot[bot] commented 1 month ago

Warning: This pull request is touching the following templated files:

danielbankhead commented 4 weeks ago

Note: Should merge #660 first.