Exemplo n.º 1
0
        private static Stream HandleException(string id, string snsTopicArn, Exception e)
        {
            Logger.Log(e);

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

            SNS.SendMessage(snsTopicArn, snsMessage);

            return(LambdaResponse.Create(id, e.Message, null));
        }
Exemplo n.º 2
0
        private static NirvanaResult GetNirvanaFailResult(StringBuilder runLog, NirvanaConfig config, ErrorCategory errorCategory, string errorMessage, string stackTrace, string snsTopicArn)
        {
            string status = GetFailedRunStatus(errorCategory, errorMessage);

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

            return(new NirvanaResult
            {
                id = config.id,
                status = status
            });
        }
Exemplo n.º 3
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.º 4
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.º 5
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.º 6
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);
        }