Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit b7f0c84

Browse files
committed
OnLoadError show brackets logo and link to open dev tools
1 parent c270663 commit b7f0c84

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

appshell/client_handler.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,22 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
166166
// Display a load error message.
167167
std::stringstream ss;
168168

169-
ss << "<html><body style='background: #3c3f41'>" <<
170-
"<!--<h2>Failed to load URL " << std::string(failedUrl) <<
171-
" with error " << std::string(errorText) << " (" << errorCode <<
172-
").</h2>--></body></html>";
169+
ss << "<html>" <<
170+
"<head>" <<
171+
" <style type='text/css'>" <<
172+
" body { background: #3c3f41; width:100%; height:100%; overflow: hidden; }" <<
173+
" .logo { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMdJREFUeNpi0Vz9SICBgWE9EDswkAYOAHEgE5maGaB61rPANGdr8QMxH1E6p177BMQfwYawwARBmv38/FAUbtq0CUxjE4cawMDEQCFgwSYIs5mQS8AG/P//nyybYfpYGP6T6fb/1HLB/39kGgDVx/L37z+yDIDpY/n35y+GJCy08YU+TB/L719/yXIBTB/L75+/wIyeky8x4h9XugCpheljFOw4vf8/eZmJgRGYI1l+/vgdCPTPemC0kGQIIyPjASYW5kCAAAMA5Oph7ZyIYMQAAAAASUVORK5CYII='); }"
174+
" .debug { cursor: hand; position: absolute; bottom: 16px; right: 16px; width: 16px; height: 16px; font-family: sans-serif; font-size: .75em; color: #999; }" <<
175+
" </style>" <<
176+
" <script type='text/javascript'>" <<
177+
" var url = '" << std::string(failedUrl) << "';" <<
178+
" var errorText = '" << std::string(errorText) << "';" <<
179+
" var errorCode = '" << errorCode << "';" <<
180+
" var msg = 'Failed to load URL ' + url + ' with error: ' + errorText + ' (' + errorCode + ')';" <<
181+
" console.error(msg);" <<
182+
" </script>" <<
183+
"</head>" <<
184+
"<body><a class='debug logo' onclick='brackets.app.showDeveloperTools()'>&nbsp;</a></body></html>";
173185
frame->LoadString(ss.str(), failedUrl);
174186
}
175187

0 commit comments

Comments
 (0)