-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/kotlin/me/nexryai/transit/templates/ErrorPageTemplate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package me.nexryai.transit.templates | ||
|
||
import io.ktor.server.html.* | ||
import kotlinx.html.* | ||
|
||
class RouteNotFoundPageTemplate(): Template<HTML> { | ||
private val head = TemplatePlaceholder<HeadTemplate>() | ||
override fun HTML.apply() { | ||
insert(HeadTemplate(), head) | ||
body { | ||
div { | ||
id = "app" | ||
div { | ||
id = "error-page" | ||
h2(classes = "error-page-title") { | ||
i(classes = "ti ti-mood-puzzled") | ||
+" Route not found" | ||
} | ||
p { | ||
+"経路が見つかりませんでした。" | ||
} | ||
ul { | ||
li { | ||
+"出発地または到着地が正しいか確認してください。" | ||
} | ||
li { | ||
+"出発地と到着地が離れすぎている可能性があります。" | ||
} | ||
li { | ||
+"一時的なシステムエラーによりこの表示が出る場合もあります。" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
class ServerErrorPageTemplate(private val message: String): Template<HTML> { | ||
private val head = TemplatePlaceholder<HeadTemplate>() | ||
override fun HTML.apply() { | ||
insert(HeadTemplate(), head) | ||
body { | ||
div { | ||
id = "app" | ||
div { | ||
id = "error-page" | ||
h2(classes = "error-page-title") { | ||
i(classes = "ti ti-zoom-exclamation") | ||
+" Something went wrong" | ||
} | ||
p { | ||
+"An unrecoverable error occurred. Unexpected exception was thrown." | ||
} | ||
p { | ||
+"Technical details: " | ||
span(classes = "error-page-detail") { | ||
+message | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters