File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,13 @@ func NonBlocking() Configurator {
223
223
}
224
224
}
225
225
226
+ // IgnoreViewLoadError Server Runing, When View load has error will be ignore.
227
+ func IgnoreViewLoadError () Configurator {
228
+ return func (app * Application ) {
229
+ app .config .IgnoreViewLoadError = true
230
+ }
231
+ }
232
+
226
233
// WithoutServerError will cause to ignore the matched "errors"
227
234
// from the main application's `Run/Listen` function.
228
235
//
@@ -976,6 +983,9 @@ type Configuration struct {
976
983
//
977
984
// Defaults to empty map.
978
985
Other map [string ]interface {} `ini:"other" json:"other,omitempty" yaml:"Other" toml:"Other"`
986
+
987
+ // IgnoreViewLoadError Server Runing, When View load has error will be ignore
988
+ IgnoreViewLoadError bool
979
989
}
980
990
981
991
var _ context.ConfigurationReadOnly = (* Configuration )(nil )
@@ -1186,6 +1196,11 @@ func (c *Configuration) GetOther() map[string]interface{} {
1186
1196
return c .Other
1187
1197
}
1188
1198
1199
+ // GetIgnoreViewLoadError returns the IgnoreViewLoadError field.
1200
+ func (c * Configuration ) GetIgnoreViewLoadError () bool {
1201
+ return c .IgnoreViewLoadError
1202
+ }
1203
+
1189
1204
// WithConfiguration sets the "c" values to the framework's configurations.
1190
1205
//
1191
1206
// Usage:
Original file line number Diff line number Diff line change @@ -740,7 +740,11 @@ func (app *Application) Build() error {
740
740
app .view .AddFunc ("urlpath" , rv .Path )
741
741
// app.view.AddFunc("url", rv.URL)
742
742
if err := app .view .Load (); err != nil {
743
- return fmt .Errorf ("build: view engine: %v" , err )
743
+ if app .config .IgnoreViewLoadError {
744
+ app .logger .Errorf ("build: view engine: %v" , err )
745
+ } else {
746
+ return fmt .Errorf ("build: view engine: %v" , err )
747
+ }
744
748
}
745
749
}
746
750
You can’t perform that action at this time.
0 commit comments