It exists cases where a custom exception type cannot be rebuilt from its
serialized form, see https://sentry.softwareheritage.org/organizations/swh/issues/4959/?query=is%3Aunresolved
As a fallback, build a base Exception with the message of the serialized exception.