コード例 #1
0
        private static NirvanaResult HandleException(StringBuilder runLog, NirvanaConfig config, Exception e, string snsTopicArn)
        {
            Logger.Log(e);
            var errorCategory = ExceptionUtilities.ExceptionToErrorCategory(e);

            return(GetNirvanaFailResult(runLog, config, errorCategory, e.Message, e.StackTrace, snsTopicArn));
        }
コード例 #2
0
        public static Stream GetStream(string id, string snsTopicArn, Exception e)
        {
            Logger.Log(e);
            GC.Collect();

            string snsMessage = SNS.CreateMessage(e.Message, "exception", e.StackTrace);

            SNS.SendMessage(snsTopicArn, snsMessage);

            ErrorCategory errorCategory = ExceptionUtilities.ExceptionToErrorCategory(e);
            string        message       = GetMessage(errorCategory, e.Message);

            LogUtilities.LogObject("Result", message);

            return(SingleResult.Create(id, message, null));
        }
コード例 #3
0
ファイル: AnnotationLambda.cs プロジェクト: wook2014/Nirvana
        private static AnnotationResult HandleException(StringBuilder runLog, AnnotationResult result, Exception e, string snsTopicArn)
        {
            Logger.Log(e);

            result.status        = e.Message;
            result.errorCategory = ExceptionUtilities.ExceptionToErrorCategory(e);
            Logger.WriteLine($"Error Category: {result.errorCategory}");

            if (result.errorCategory != ErrorCategory.UserError)
            {
                string snsMessage = SNS.CreateMessage(runLog.ToString(), result.status, e.StackTrace);
                SNS.SendMessage(snsTopicArn, snsMessage);
            }

            LogUtilities.LogObject("Result", result);
            return(result);
        }
コード例 #4
0
        private ValidationResult HandleException(string id, Exception exception, string snsTopicArn)
        {
            Logger.Log(exception);

            string snsMessage = SNS.CreateMessage(exception.Message, "exception", exception.StackTrace);

            SNS.SendMessage(snsTopicArn, snsMessage);

            ErrorCategory errorCategory      = ExceptionUtilities.ExceptionToErrorCategory(exception);
            var           errorMessagePrefix = errorCategory == ErrorCategory.UserError ? "User error" : "Nirvana error";

            return(new ValidationResult
            {
                id = id,
                status = $"{errorMessagePrefix}: {exception.Message}"
            });
        }
コード例 #5
0
        private static CustomResult HandleException(StringBuilder runLog, CustomResult result, Exception e, string snsTopicArn)
        {
            Logger.Log(e);

            var errorCategory = ExceptionUtilities.ExceptionToErrorCategory(e);

            result.status = $"{errorCategory}: {e.Message}";

            if (errorCategory != ErrorCategory.UserError)
            {
                string snsMessage = SNS.CreateMessage(runLog.ToString(), result.status, e.StackTrace);
                SNS.SendMessage(snsTopicArn, snsMessage);
            }

            LogUtilities.LogObject("Result", result);
            LambdaUtilities.DeleteTempOutput();

            return(result);
        }
コード例 #6
0
ファイル: AnnotationJob.cs プロジェクト: shannonnana/Nirvana
        internal AnnotationResultSummary GetResultSummaryFromFailedInvocation(Exception e)
        {
            var additionalDescription = "";

            if (ExceptionUtilities.HasException <TaskCanceledException>(e))
            {
                _errorCategory        = ErrorCategory.TimeOutError;
                additionalDescription = $" Annotation job was not finished in {_annotationTimeOut} milliseconds.";
            }

            if (_errorCategory == null)
            {
                _errorCategory = ExceptionUtilities.ExceptionToErrorCategory(e);
            }

            e = ExceptionUtilities.GetInnermostException(e);
            string errorMessage = $"Failed job when invoking the annotation job: {e.Message}.{additionalDescription}";

            return(AnnotationResultSummary.Create(null, _errorCategory, errorMessage));
        }