api/serializers: Handle case where an exception can not be rebuilt
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.
Migrated from D4730 (view on Phabricator)