fix: check error type on file not found (#2383)
This commit is contained in:
parent
8beeba7c0c
commit
a02d9c8463
@ -1,6 +1,7 @@
|
|||||||
package static
|
package static
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -18,7 +19,7 @@ import (
|
|||||||
func InitIndex() {
|
func InitIndex() {
|
||||||
index, err := public.Public.ReadFile("dist/index.html")
|
index, err := public.Public.ReadFile("dist/index.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == fs.ErrNotExist {
|
if errors.Is(err, fs.ErrNotExist) {
|
||||||
utils.Log.Fatalf("index.html not exist, you may forget to put dist of frontend to public/dist")
|
utils.Log.Fatalf("index.html not exist, you may forget to put dist of frontend to public/dist")
|
||||||
}
|
}
|
||||||
utils.Log.Fatalf("failed to read index.html: %v", err)
|
utils.Log.Fatalf("failed to read index.html: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user