Concordium / concordium-dapp-piggybank

2 stars 0 forks source link

Add utility function for extracting string from error #5

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.

This is essentially the same change as https://github.com/Concordium/concordium-dapp-libraries/pull/17 in the dApp libs.