Esempio n. 1
0
        private async Task <InfoResponse> TryScheduleTimeTask(JObject json)
        {
            try
            {
                var task     = _timeTaskConvert.FromJson(json);
                var response = await _clockService.ScheduleTimeTask(task.JobType, task.GetType(), task);

                return(response);
            }
            catch (ArgumentException e)
            {
                _logger.LogDebug($"{e.Message}");
                throw new WebApiException(HttpStatusCode.BadRequest, "", e);
            }
            catch (JsonSerializationException e)
            {
                _logger.LogDebug($"{e.Message}");
                throw new WebApiException(HttpStatusCode.BadRequest, "", e);
            }
            catch (InvalidOperationException e)
            {
                _logger.LogDebug($"{e.Message}");
                throw new WebApiException(HttpStatusCode.InternalServerError, "", e);
            }
            catch (Exception e)
            {
                _logger.LogError($"{e.Message}");
                throw new WebApiException(HttpStatusCode.InternalServerError, "", e);
            }
        }