This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utility | |
import ( | |
"fmt" | |
"os" | |
"github.com/civo/cli/common" | |
) | |
const ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package civo | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"os" | |
"path/filepath" | |
"github.com/civo/civogo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import "strings" | |
// IsRetryableError determines if an error is retryable | |
func IsRetryableError(err error) bool { | |
for _, error := range RetryableErrors { | |
if strings.Contains(err.Error(), error) { | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CustomError stores a part of the complete API error | |
type CustomError struct { | |
Code string `json:"code"` | |
Reason string `json:"reason"` | |
} | |
// Error implements the error interface | |
func (e *CustomError) Error() string { | |
return fmt.Sprintf("%s - %s", e.Code, e.Reason) | |
} |