private Task ErrorResponse(HttpContext ctx, int statusCode,
                                   HftApiErrorCode code, string message, Dictionary <string, string> fields = null)
        {
            ctx.Response.ContentType = "application/json";
            ctx.Response.StatusCode  = statusCode;

            var response = ResponseModel.Fail(code, message, fields ?? new Dictionary <string, string>());

            return(ctx.Response.WriteAsync(JsonConvert.SerializeObject(response,
                                                                       new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            })));
        }
 public static HftApiException Create(HftApiErrorCode code, string message)
 {
     return(new HftApiException(code, message));
 }
 public HftApiException(HftApiErrorCode code, string message) : base(message)
 {
     ErrorCode = code;
 }