Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 79b1cde

Browse files
committed
add eror view
1 parent fae817e commit 79b1cde

6 files changed

Lines changed: 60 additions & 1 deletion

File tree

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

app/error.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
include 'utils.php';
3+
$dark = isset($_GET['theme']) && $_GET['theme'] === 'dark';
4+
5+
$header = $dark ? "#fff" : "#434d58";
6+
$background = $dark ? "#000" : "#fffefe";
7+
8+
ob_start('compress_output');
9+
?>
10+
11+
<svg width="540" viewBox="0 0 660 216" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="descId">
12+
<title id="titleId">Error</title>
13+
<desc id="descId">User Code Statistics</desc>
14+
<style>
15+
.header {
16+
font: 600 18px 'Segoe UI', Ubuntu, Sans-Serif;
17+
fill: <?php echo $header; ?>;
18+
animation: fadeInAnimation 0.8s ease-in-out forwards
19+
}
20+
@supports(appearance: auto) {
21+
.header {
22+
font-size: 16px
23+
}
24+
}
25+
#rect-mask rect {
26+
animation: fadeInAnimation 1s ease-in-out forwards
27+
}
28+
@keyframes fadeInAnimation {
29+
from {
30+
opacity:0
31+
}
32+
to {
33+
opacity:1
34+
}
35+
}
36+
</style>
37+
<rect data-testid="card-bg" x="0.5" y="0.5" rx="4.5" height="99%" stroke="#e4e2e2" width="659" fill="<?php echo $background; ?>" stroke-opacity="1"/>
38+
<g data-testid="card-title" transform="translate(200, 108)">
39+
<g transform="translate(0, 0)">
40+
<text x="0" y="0" class="header" data-testid="header">Sorry, there is something wrong...</text>
41+
</g>
42+
</g>
43+
</svg>
44+
45+
<?php
46+
ob_end_flush();
47+
?>

app/repo.php

Whitespace-only changes.

app/utils.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
function compress_output($buffer)
4+
{
5+
$search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s', '/> </s');
6+
$replace = array('>', '<', '\\1', '><');
7+
return preg_replace($search, $replace, $buffer);
8+
}

cache.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ func EndBody(ctx iris.Context, data AnalysisData) {
9292

9393
func EndBodyWithCache(ctx iris.Context, data AnalysisData) {
9494
err := SetJSONCache(ctx, ctx.Path(), data)
95+
if conf.Debug {
96+
logger.Debugf("Set cache of %s", ctx.Path())
97+
}
9598
if err != nil {
9699
logger.Errorf("Failed to set cache: %s", err.Error())
97100
ThrowError(ctx, err.Error(), iris.StatusInternalServerError)

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
debug: true
1+
debug: false
22
server:
33
port: 8080
44

0 commit comments

Comments
 (0)