Skip to content

Commit

Permalink
skip packstate generator error
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Apr 2, 2024
1 parent 34183f1 commit c3a83c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@ var RootCmd = &cobra.Command{
// save state file
packState, err := packstate.FromArchive(zipPath)
if err != nil {
log.Fatalln(err)
}
err = packState.Save(serverDir)
if err != nil {
log.Fatalln(err)
log.Printf("Unable to generate %s: %s\n", packstate.FileName, err)
} else {
err = packState.Save(serverDir)
if err != nil {
log.Fatalln(err)
}
}

files.RmEmptyDirs(serverDir)
Expand Down
1 change: 1 addition & 0 deletions update/packstate/packstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func FromArchive(path string) (*Schema, error) {

version, err := modrinth.Client.VersionFromMrpackFile(path)
if err != nil {
// TODO: check for 404 status for custom error
return nil, err
}
project, err := modrinth.Client.GetProject(version.ProjectId)
Expand Down
1 change: 1 addition & 0 deletions web/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (c *Client) GetModel(url string, respModel interface{}, errModel error, dec
}(res.Body)

if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest {
// TODO: error struct with more details
if errModel == nil || json.NewDecoder(res.Body).Decode(&errModel) != nil {
return errors.New("http status " + strconv.Itoa(res.StatusCode))
}
Expand Down

0 comments on commit c3a83c7

Please sign in to comment.