commit
cf8c1769c5
3 changed files with 80 additions and 65 deletions
120
data/bindata.go
120
data/bindata.go
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,7 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|
@ -69,6 +70,12 @@ func Run(process *process.Process) interface{} {
|
||||||
// Get the page config
|
// Get the page config
|
||||||
cfg, err := getPageConfig(file, r.Request.DisableCache())
|
cfg, err := getPageConfig(file, r.Request.DisableCache())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
|
if err.Error() == "The config file not found" {
|
||||||
|
exception.New("The page not found (%s)", 404, route).Throw()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
log.Error("Can't load the page config (%s), %s", route, err.Error())
|
log.Error("Can't load the page config (%s), %s", route, err.Error())
|
||||||
exception.New("Can't load the page config (%s), get more information from the log.", 500, route).Throw()
|
exception.New("Can't load the page config (%s), get more information from the log.", 500, route).Throw()
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -135,7 +142,7 @@ func getPageConfig(file string, disableCache ...bool) (*core.PageConfig, error)
|
||||||
|
|
||||||
file = base + ".cfg"
|
file = base + ".cfg"
|
||||||
if exist, _ := application.App.Exists(file); !exist {
|
if exist, _ := application.App.Exists(file); !exist {
|
||||||
return nil, nil
|
return nil, fmt.Errorf("The config file not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
source, err := application.App.Read(file)
|
source, err := application.App.Read(file)
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,20 @@ class __Query {
|
||||||
return this.elements;
|
return this.elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
find(selector: string): __Query {
|
find(selector: string): __Query | null {
|
||||||
return new __Query(this.element?.querySelector(selector) || "");
|
const elm = this.element?.querySelector(selector);
|
||||||
|
if (elm) {
|
||||||
|
return new __Query(elm);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
closest(selector: string): __Query {
|
closest(selector: string): __Query | null {
|
||||||
return new __Query(this.element?.closest(selector) || "");
|
const elm = this.element?.closest(selector);
|
||||||
|
if (elm) {
|
||||||
|
return new __Query(elm);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
on(event: string, callback: (event: Event) => void): __Query {
|
on(event: string, callback: (event: Event) => void): __Query {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue