function handler(requestHandler, successHandler, errorHandler) {
  async function handleRequest(koaCtx) {
    try {
      const result = await requestHandler(koaCtx);
      successHandler(koaCtx, result);
    } catch (error) {
      errorHandler(koaCtx, error);
    }
  }

  return handleRequest;
}
//  the endpoint returns a raw result or a wrapped Swatch result
the endpoint returns a raw result or a wrapped Swatch result
the endpoint returns a raw result or a wrapped Swatch result
function handler(requestHandler, successHandler, errorHandler) {
  async function handleRequest(koaCtx) {
    try {
      const result = await requestHandler(koaCtx);
      successHandler(koaCtx, result);
    } catch (error) {
      errorHandler(koaCtx, error);
    }
  }
  return handleRequest;
}
function handler ( requestHandler , successHandler , errorHandler ) { async function handleRequest ( koaCtx ) { try { const result = await requestHandler ( koaCtx ) ; successHandler ( koaCtx , result ) ; } catch ( error ) { errorHandler ( koaCtx , error ) ; } } return handleRequest ; }
the endpoint returns a raw result or a wrapped Swatch result
the endpoint returns a raw result or a wrapped Swatch result