Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Add error interface to diag.Diagnostic (#128)
Browse files Browse the repository at this point in the history
* Add `error` interface to diag.Diagnostic

Co-authored-by: Kemal Hadimli <[email protected]>
  • Loading branch information
disq and disq authored Dec 15, 2021
1 parent e827e07 commit 5493f85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cqproto/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cqproto

import (
"context"
"fmt"

"github.com/cloudquery/cq-provider-sdk/provider/schema"
"github.com/cloudquery/cq-provider-sdk/provider/schema/diag"
Expand Down Expand Up @@ -182,3 +183,9 @@ func (p ProviderDiagnostic) Description() diag.Description {
Detail: p.Details,
}
}

func (p ProviderDiagnostic) Error() string {
return fmt.Sprintf("%s: %s", p.ResourceName, p.Summary)
}

var _ diag.Diagnostic = (*ProviderDiagnostic)(nil)
1 change: 1 addition & 0 deletions provider/schema/diag/diagnostic.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Diagnostic interface {
Severity() Severity
Type() DiagnosticType
Description() Description
error
}

type Description struct {
Expand Down

0 comments on commit 5493f85

Please sign in to comment.