@@ -18,7 +18,12 @@ func HandleGoHtmlMultiple(w http.ResponseWriter, r *http.Request) {
1818 toastHTMLGenerator := goaster .NewHTMLGenerator ()
1919
2020 // Render the needed CSS for toast component as template.HTML
21- toastCSS , _ := toastHTMLGenerator .GoasterCSSToGoHTML ()
21+ toastCSS , err := toastHTMLGenerator .GoasterCSSToGoHTML ()
22+ if err != nil {
23+ http .Error (w , "failed to render toast CSS" , http .StatusInternalServerError )
24+ log .Printf ("failed to render toast CSS: %v" , err )
25+ return
26+ }
2227
2328 // Push messages
2429 toaster .PushDefault ("Default Toast" )
@@ -29,9 +34,19 @@ func HandleGoHtmlMultiple(w http.ResponseWriter, r *http.Request) {
2934
3035 // Render the toast component into a template.HTML
3136 toastHtml , err := toastHTMLGenerator .DisplayAll (toaster )
37+ if err != nil {
38+ http .Error (w , "failed to render toast HTML" , http .StatusInternalServerError )
39+ log .Printf ("failed to render toast HTML: %v" , err )
40+ return
41+ }
3242
3343 // Render the needed JS for toast component as template.HTML
34- toastJS , _ := toastHTMLGenerator .GoasterJSToGoHTML (toaster , nil )
44+ toastJS , err := toastHTMLGenerator .GoasterJSToGoHTML (toaster , nil )
45+ if err != nil {
46+ http .Error (w , "failed to render toast JS" , http .StatusInternalServerError )
47+ log .Printf ("failed to render toast JS: %v" , err )
48+ return
49+ }
3550
3651 data := types.PageData {
3752 Toast : types.ToastComponent {
0 commit comments