Пример #1
0
 public EmailService(
     IAwsService awsService,
     IThimbleLogger thimbleLogger)
 {
     _awsService    = awsService;
     _thimbleLogger = thimbleLogger;
 }
Пример #2
0
 public UserAccountController(
     IContactInformationDynamoClient contactInformationDynamoClient,
     IThimbleLogger thimbleLogger)
 {
     _contactInformationDynamoClient = contactInformationDynamoClient;
     _thimbleLogger = thimbleLogger;
 }
 public CredentialsController(
     ICredentialsDynamoClient credentialsDynamoClient,
     IThimbleLogger thimbleLogger)
 {
     _credentialsDynamoClient = credentialsDynamoClient;
     _thimbleLogger           = thimbleLogger;
 }
        public async Task Invoke(HttpContext context, IThimbleLogger thimbleLogger)
        {
            try
            {
                await _next(context);
            }
            catch (Exception ex)
            {
                context.Response.Clear();
                context.Response.StatusCode  = 500;
                context.Response.ContentType = "application/json";

                var responseObject = new ErrorResponse {
                    Message = ex.Message
                };

                if (ex.GetType() == typeof(InvalidEmailOrPasswordException))
                {
                    SetResponse(StaticErrorResponses.Unauthorized, context, responseObject);
                }

                var serializedBody = JsonConvert.SerializeObject(responseObject, Formatting.Indented,
                                                                 new JsonSerializerSettings
                {
                    Formatting         = Formatting.Indented,
                    DateFormatHandling = DateFormatHandling.IsoDateFormat,
                    NullValueHandling  = NullValueHandling.Ignore,
                    ContractResolver   = new CamelCasePropertyNamesContractResolver()
                });
                thimbleLogger.Log(ex, "credentials.error");
                await context.Response.WriteAsync(serializedBody, Encoding.UTF8);
            }
        }
 public MessagingController(
     IEmailService emailService,
     IThimbleLogger thimbleLogger)
 {
     _emailService  = emailService;
     _thimbleLogger = thimbleLogger;
 }