Concordium / concordium-dapp-libraries

A coherent set of building blocks for making it as easy as possible for developers to build web-based dApps.
Apache License 2.0
7 stars 5 forks source link

Add utility function for extracting string from error #17

Closed bisgardo closed 1 year ago

bisgardo commented 1 year ago

Purpose

Ensure that non-Error exceptions don't go undetected.

Changes

Compared to the usual strategy of using (err as Error).message, this function adds a fallback to just treating the value as a string. This avoids errors that aren't actually of type Error to be masked as described in https://concordium.atlassian.net/browse/CBW-780.