StartupExceptionApplication.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License. See License.txt in the project root for license information.
  3. #pragma once
  4. #include "InProcessApplicationBase.h"
  5. #include "ServerErrorHandler.h"
  6. #include "resource.h"
  7. class StartupExceptionApplication : public InProcessApplicationBase
  8. {
  9. public:
  10. StartupExceptionApplication(
  11. IHttpServer& pServer,
  12. IHttpApplication& pApplication,
  13. HINSTANCE moduleInstance,
  14. BOOL disableLogs,
  15. HRESULT hr,
  16. std::vector<byte>&& errorPageContent
  17. )
  18. : m_disableLogs(disableLogs),
  19. m_HR(hr),
  20. m_moduleInstance(moduleInstance),
  21. m_errorPageContent(std::move(errorPageContent)),
  22. InProcessApplicationBase(pServer, pApplication)
  23. {
  24. }
  25. ~StartupExceptionApplication() = default;
  26. HRESULT CreateHandler(IHttpContext* pHttpContext, IREQUEST_HANDLER** pRequestHandler)
  27. {
  28. *pRequestHandler = new ServerErrorHandler(*pHttpContext, 500, 30, "Internal Server Error", m_HR, m_moduleInstance, m_disableLogs, IN_PROCESS_RH_STATIC_HTML, m_errorPageContent);
  29. return S_OK;
  30. }
  31. private:
  32. std::vector<byte> m_errorPageContent;
  33. BOOL m_disableLogs;
  34. HRESULT m_HR;
  35. HINSTANCE m_moduleInstance;
  36. };