1 /* 2 AirSane Imaging Daemon 3 Copyright (C) 2018-2021 Simul Piscator 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #include "errorpage.h" 20 #include "httpserver.h" 21 #include <sstream> 22 ErrorPage(int errorCode)23ErrorPage::ErrorPage(int errorCode) 24 : mErrorCode(errorCode) 25 { 26 std::ostringstream oss; 27 oss << "Error " << errorCode << ": " << HttpServer::statusReason(errorCode); 28 setTitle(oss.str()); 29 } 30 31 void onRender()32ErrorPage::onRender() 33 { 34 std::ostringstream oss; 35 oss << request(); 36 out() << heading(1).addText(title()) << std::endl 37 << paragraph().addText("when processing request: ") << std::endl 38 << paragraph().addText(oss.str()); 39 } 40