Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
fix all prints in BackendClient to print the message and not the poin…
Browse files Browse the repository at this point in the history
…ter (#157)
  • Loading branch information
FrimIdan authored Mar 19, 2023
1 parent fcb350c commit d528d68
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions shared/pkg/backendclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (b *BackendClient) PostScan(ctx context.Context, scan models.Scan) (*models
}
default:
if resp.JSONDefault != nil && resp.JSONDefault.Message != nil {
return nil, fmt.Errorf("failed to post scan. status code=%v: %v", resp.StatusCode(), resp.JSONDefault.Message)
return nil, fmt.Errorf("failed to post scan. status code=%v: %v", resp.StatusCode(), *resp.JSONDefault.Message)
}
return nil, fmt.Errorf("failed to post scan. status code=%v", resp.StatusCode())
}
Expand Down Expand Up @@ -162,7 +162,7 @@ func (b *BackendClient) PostScanResult(ctx context.Context, scanResult models.Ta
}
default:
if resp.JSONDefault != nil && resp.JSONDefault.Message != nil {
return nil, fmt.Errorf("failed to post scan result. status code=%v: %v", resp.StatusCode(), resp.JSONDefault.Message)
return nil, fmt.Errorf("failed to post scan result. status code=%v: %v", resp.StatusCode(), *resp.JSONDefault.Message)
}
return nil, fmt.Errorf("failed to post scan result. status code=%v", resp.StatusCode())
}
Expand All @@ -181,7 +181,7 @@ func (b *BackendClient) PatchScan(ctx context.Context, scanID models.ScanID, sca
return nil
default:
if resp.JSONDefault != nil && resp.JSONDefault.Message != nil {
return fmt.Errorf("failed to patch scan. status code=%v: %v", resp.StatusCode(), resp.JSONDefault.Message)
return fmt.Errorf("failed to patch scan. status code=%v: %v", resp.StatusCode(), *resp.JSONDefault.Message)
}
return fmt.Errorf("failed to patch scan. status code=%v", resp.StatusCode())
}
Expand Down Expand Up @@ -234,7 +234,7 @@ func (b *BackendClient) PatchTargetScanStatus(ctx context.Context, scanResultID
return fmt.Errorf("failed to update scan result status, not found")
default:
if resp.JSONDefault != nil && resp.JSONDefault.Message != nil {
return fmt.Errorf("failed to update scan result status. status code=%v: %v", resp.StatusCode(), resp.JSONDefault.Message)
return fmt.Errorf("failed to update scan result status. status code=%v: %v", resp.StatusCode(), *resp.JSONDefault.Message)
}
return fmt.Errorf("failed to update scan result status. status code=%v", resp.StatusCode())
}
Expand All @@ -253,7 +253,7 @@ func (b *BackendClient) GetScan(ctx context.Context, scanID string, params model
return resp.JSON200, nil
default:
if resp.JSONDefault != nil && resp.JSONDefault.Message != nil {
return nil, fmt.Errorf("failed to get a scan status. status code=%v: %v", resp.StatusCode(), resp.JSONDefault.Message)
return nil, fmt.Errorf("failed to get a scan status. status code=%v: %v", resp.StatusCode(), *resp.JSONDefault.Message)
}
return nil, fmt.Errorf("failed to get a scan status. status code=%v", resp.StatusCode())
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (b *BackendClient) PostTarget(ctx context.Context, target models.Target) (*
}
default:
if resp.JSONDefault != nil && resp.JSONDefault.Message != nil {
return nil, fmt.Errorf("failed to post target. status code=%v: %v", resp.StatusCode(), resp.JSONDefault.Message)
return nil, fmt.Errorf("failed to post target. status code=%v: %v", resp.StatusCode(), *resp.JSONDefault.Message)
}
return nil, fmt.Errorf("failed to post target. status code=%v", resp.StatusCode())
}
Expand Down

0 comments on commit d528d68

Please sign in to comment.