From a2b6f0fbf596f6f0fe2829980686b4515e8368a1 Mon Sep 17 00:00:00 2001 From: Antonio Pagano Date: Thu, 3 Feb 2022 07:47:48 -0500 Subject: [PATCH] task: moving error templates to files --- error.dev.html | 647 +++++++++++++++++++++++++++++++++++++++++++++ error.prod.html | 70 +++++ error_templates.go | 131 +-------- notfound.prod.html | 71 +++++ 4 files changed, 799 insertions(+), 120 deletions(-) create mode 100644 error.dev.html create mode 100644 error.prod.html create mode 100644 notfound.prod.html diff --git a/error.dev.html b/error.dev.html new file mode 100644 index 000000000..8629916e7 --- /dev/null +++ b/error.dev.html @@ -0,0 +1,647 @@ + + + + + + + + + <%= status %> - ERROR! + + + + + +
+
+
+ +
+

+ <%= status %> - ERROR! +

+
+
+
+
+ +
+
+
+

Error Trace

+
<%= error %>
+ +

Context

+
<%= inspect(context) %>
+ +

Parameters

+
<%= inspect(params) %>
+ +

Headers

+
<%= inspect(headers) %>
+ +

Form

+
<%= inspect(posted_form) %>
+ +

Routes

+ + + + + + + + + + + + <%= for (r) in routes { %> + + + + + + + <% } %> + + +
METHODPATHNAMEHANDLER
+ <%= r.Method %> + + <%= if (r.Method !="GET" || r.Path ~="{" ) { %> + <%= r.Path %> + <% } else { %> + + <%= r.Path %> + + <% } %> + + <%= r.PathName %> + <%= r.HandlerName %>
+
+
+
Powered by gobuffalo.io
+
+ + + \ No newline at end of file diff --git a/error.prod.html b/error.prod.html new file mode 100644 index 000000000..091a176ee --- /dev/null +++ b/error.prod.html @@ -0,0 +1,70 @@ + + + + + + + +
+
+

We're Sorry!

+
+

It looks like something went wrong! Don't worry, we are aware of the problem and are looking into it.

+

Sorry if this has caused you any problems. Please check back again later.

+
+ +

powered by gobuffalo.io

+
+ + + \ No newline at end of file diff --git a/error_templates.go b/error_templates.go index 63f82b878..2fb4d13d9 100644 --- a/error_templates.go +++ b/error_templates.go @@ -1,125 +1,16 @@ package buffalo -var devErrorTmpl = ` - - - <%= status %> - ERROR! - - +import ( + _ "embed" +) - -
-
-
- -
-

- <%= status %> - ERROR! -

-
-
-
-
+var ( + //go:embed error.dev.html + devErrorTmpl string -
-
-
-

Error Trace

-
<%= error %>
+ //go:embed error.prod.html + prodErrorTmpl string -

Context

-
<%= inspect(context) %>
- -

Parameters

-
<%= inspect(params) %>
- -

Headers

-
<%= inspect(headers) %>
- -

Form

-
<%= inspect(posted_form) %>
- -

Routes

- - - - - - - - - - - - <%= for (r) in routes { %> - - - - - - - <% } %> - - -
METHODPATHNAMEHANDLER
- <%= r.Method %> - - <%= if (r.Method != "GET" || r.Path ~= "{") { %> - <%= r.Path %> - <% } else { %> - <%= r.Path %> - <% } %> - - <%= r.PathName %> - <%= r.HandlerName %>
-
-
-
Powered by gobuffalo.io
-
- - -` -var prodErrorTmpl = ` - - - - - - -
-
-

We're Sorry!

-
-

It looks like something went wrong! Don't worry, we are aware of the problem and are looking into it.

-

Sorry if this has caused you any problems. Please check back again later.

-
- -

powered by gobuffalo.io

-
- - -` - -var prodNotFoundTmpl = ` - - - - - - -
-
-

Not Found

-
-

The page you're looking for does not exist, you may have mistyped the address or the page may have been moved.

-
- -

powered by gobuffalo.io

-
- - -` + //go:embed notfound.prod.html + prodNotFoundTmpl string +) diff --git a/notfound.prod.html b/notfound.prod.html new file mode 100644 index 000000000..3c1ab654c --- /dev/null +++ b/notfound.prod.html @@ -0,0 +1,71 @@ + + + + + + + + +
+
+

Not Found

+
+

The page you're looking for does not exist, you may have mistyped the address or the page may have been + moved.

+
+ +

powered by gobuffalo.io

+
+ + + \ No newline at end of file