private async Task WriteExceptionToResponse(HttpContext context, ExceptionDetails error)
 {
     context.Response.StatusCode  = (int)error.Code;
     context.Response.ContentType = "application/json";
     await context.Response.WriteAsync(JsonConvert.SerializeObject(error));
 }
        private async Task UnhandledException(HttpContext httpContext, Exception exception)
        {
            var error = ExceptionDetails.Create(exception.Message, -1000);

            await WriteExceptionToResponse(httpContext, error);
        }
        private async Task HandleBusinessException(HttpContext context, ProtossException ProtossException)
        {
            var error = ExceptionDetails.Create(ProtossException.ExceptionMessage, ProtossException.Code);

            await WriteExceptionToResponse(context, error);
        }