Skip to content

Commit

Permalink
fix(profile): catch error for profile api and console log error (carb…
Browse files Browse the repository at this point in the history
…on-design-system#5088)

### Related Ticket(s)

[Unhandled Runtime Error carbon-design-system#32](carbon-design-system/carbon-for-ibm-dotcom-nextjs-template#32)

### Description

Catch the profile api call error and console log it in attempt to prevent error overlay from appearing in nextjs template dev mode.

### Changelog

**Changed**

- catch error and console log while returning `Unauthenticated`

<!-- React and Web Component deploy previews are enabled by default. -->
<!-- To enable additional available deploy previews, apply the following -->
<!-- labels for the corresponding package: -->
<!-- *** "package: services": Services -->
<!-- *** "package: utilities": Utilities -->
<!-- *** "package: styles": Carbon Expressive -->
<!-- *** "RTL": React / Web Components (RTL) -->
<!-- *** "feature flag": React / Web Components (experimental) -->
  • Loading branch information
annawen1 authored and IgnacioBecerra committed Feb 22, 2021
1 parent 952a870 commit 6c13690
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/services/src/services/Profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class ProfileAPI {
},
withCredentials: true,
})
.then(response => response.data);
.then(response => response.data)
.catch(error => {
console.log('Failed Profile Network Call', error);
return { user: 'Unauthenticated' };
});
}
}

Expand Down

0 comments on commit 6c13690

Please sign in to comment.