complete rewrite of project
This commit is contained in:
parent
bcd4b5d165
commit
614c320fee
6
file.go
6
file.go
@ -4,16 +4,14 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"0cd.xyz-go/logger"
|
||||
)
|
||||
|
||||
// File reads request json file
|
||||
func File(path string) ([]byte, *logger.HTTPError) {
|
||||
func File(path string) ([]byte, error) {
|
||||
jsonFile, err := os.Open(path)
|
||||
if err != nil {
|
||||
log.Println("Error reading request. ", err)
|
||||
return nil, &logger.HTTPError{Status: "500 Internal Server Error", StatusCode: 500}
|
||||
return nil, err
|
||||
}
|
||||
defer jsonFile.Close()
|
||||
byteValue, _ := ioutil.ReadAll(jsonFile)
|
||||
|
Loading…
Reference in New Issue
Block a user