Skip to content

Commit

Permalink
fix: Add error message for unauthorized user. (#871)
Browse files Browse the repository at this point in the history
This commit adds an error message if a user is not authorized to create
private apps.
  • Loading branch information
betterengineering authored Aug 23, 2023
1 parent 25e5e8f commit 7446206
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/http"
"os"
"path/filepath"
"strings"
"time"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -87,6 +88,10 @@ var CreateCmd = &cobra.Command{

app.ID, err = createPrivateApp(apiToken, createOrg)
if err != nil {
if strings.Contains(err.Error(), "user is not authorized to create apps") {
return fmt.Errorf("user is not authorized to create apps for organization %s, please reach out to your Tidbyt For Teams account representative to enable this feature for your account", createOrg)
}

return fmt.Errorf("remote app creation failed: %w", err)
}
}
Expand Down

0 comments on commit 7446206

Please sign in to comment.