/// <exception cref="UnAuthorizedProjectException">Thrown when the project is not valid or active</exception> /// <exception cref="UnableToAddExceptionizerMessageException">Thrown when we have been unable to fully persist the exception message</exception> public void Add(ExceptionizerMessage message) { try { authorizationService.AuthorizeProject(Guid.Parse(message.ApiKey)); var messageDto = Mapper.Map <ExceptionizerMessageDto>(message); exceptionRepository.Add(messageDto); } catch (UnAuthorizedProjectException exception) { //Already logged throw; } catch (UnableToPersistToMongoDbException exception) { logger.Log(ExceptionType.ExceptionizerApi, "ExceptionService: Add", exception); throw new UnableToAddExceptionizerMessageException("Cannot add message to mongodb", exception); } catch (UnableToPersistToElasticSearchException exception) { logger.Log(ExceptionType.ExceptionizerApi, "ExceptionService: Add", exception); throw new UnableToAddExceptionizerMessageException("Cannot add message to elasticsearch", exception); } catch (Exception exception) { logger.Log(ExceptionType.Unhandled, "ExceptionService: Add", exception); throw new UnableToAddExceptionizerMessageException("UNHANDLED EXCEPTION!", exception); } }