protected function wrap(callable $process, $successSpecResult = null): ResponseInterface
    {
        try {
            $result = $process();

        } catch (ValidationException $e) {
            return $this->failWithException($e);

        } catch (UserAuthException $e) {
            return $this->failWithAuth();

        } catch (NotFoundHttpException $e) {
            return $this->failWithNotFound();

        } catch (\Throwable $e) {
            return $this->failWithException($e);
        }

        if(!is_null($successSpecResult)) {
            $result = $successSpecResult;
        }

        if ($result instanceof ResponseInterface) {
            return $result;
        }

        return $this->success($result);
    }