Example #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));
        }
Example #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));
        }
Example #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);
        }
        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}"
            });
        }
Example #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);
        }
Example #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));
        }