Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 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}"
            });
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        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));
        }