plaid / plaid-node

Node bindings for Plaid
https://plaid.com/docs
MIT License
525 stars 173 forks source link

Is the error handling code in the README correct ? #599

Closed Ranhiru closed 1 year ago

Ranhiru commented 1 year ago

Is this still valid ?

https://github.com/plaid/plaid-node#error-handling

try {
  await plaidClient.transactionsSync(request);
} catch (error) {
  const err = error.response.data;
}

That part of the README has not been updated for 2 years and it seems like that part is not up to date anymore. Can someone from Plaid chime in please ?

Thank you

cgfarmer4 commented 1 year ago

Hi @Ranhiru -- yes, this is still the recommended error handling format. We have tests here that show how this works more in depth.

Are you receiving something unexpected?

Ranhiru commented 1 year ago

@cgfarmer4 Thanks you. Are there type definitions for error ? Is it PlaidError ? Or is error.response.data is of type PlaidError ?

cgfarmer4 commented 1 year ago

Error and response are Axios types but you are correct, error.response.data is of type PlaidError.

Ranhiru commented 1 year ago

Thank you :)