public async Task <ActionResult <TaskAggregate> > GetTask(string taskId)
 {
     try
     {
         return(Ok(await _tasksManager.GetTaskAsync(taskId)));
     }
     catch (NotFoundException nfe)
     {
         return(NotFound(nfe.Message));
     }
     catch (Exception e)
     {
         return(BadRequest($"{e.GetType().Name} : {e.Message}\n{e.StackTrace}"));
     }
 }
예제 #2
0
        public async Task <ActionResult <TaskAggregate> > GetTask(string taskId)
        {
            try
            {
                var result = await _tasksManager.GetTaskAsync(taskId);

                var task = result.task;
                if (result.fromCache)
                {
                    Response.StatusCode = (int)_cacheFoundCode;
                    return(task);;
                }
                return(Ok(task));
            }
            catch (NotFoundException nfe)
            {
                return(NotFound(nfe.Message));
            }
            catch (Exception e)
            {
                return(BadRequest($"{e.GetType().Name} : {e.Message}\n{e.StackTrace}"));
            }
        }