public static function fromData($error, array $details = []): self
    {
        if ($error instanceof self) {
            return $error;
        }

        if (!is_string($error)) {
            throw new \InvalidArgumentException('Given error must either be an error id or an instance of ' . __CLASS__);
        }

        return new self($error, $details);
    }