Skip to content

Commit 7afde79

Browse files
committed
AUTH-2890: adds error handler to cli actions
1 parent 3d782f7 commit 7afde79

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

cmd/cloudflared/linux_service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"path/filepath"
99

10+
"github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil"
1011
"github.com/cloudflare/cloudflared/cmd/cloudflared/config"
1112
"github.com/cloudflare/cloudflared/logger"
1213
"github.com/pkg/errors"
@@ -21,12 +22,12 @@ func runApp(app *cli.App, shutdownC, graceShutdownC chan struct{}) {
2122
&cli.Command{
2223
Name: "install",
2324
Usage: "Install Argo Tunnel as a system service",
24-
Action: installLinuxService,
25+
Action: cliutil.ErrorHandler(installLinuxService),
2526
},
2627
&cli.Command{
2728
Name: "uninstall",
2829
Usage: "Uninstall the Argo Tunnel service",
29-
Action: uninstallLinuxService,
30+
Action: cliutil.ErrorHandler(uninstallLinuxService),
3031
},
3132
},
3233
})

cmd/cloudflared/macos_service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"gopkg.in/urfave/cli.v2"
1010

11+
"github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil"
1112
"github.com/cloudflare/cloudflared/logger"
1213
"github.com/pkg/errors"
1314
)
@@ -24,12 +25,12 @@ func runApp(app *cli.App, shutdownC, graceShutdownC chan struct{}) {
2425
{
2526
Name: "install",
2627
Usage: "Install Argo Tunnel as an user launch agent",
27-
Action: installLaunchd,
28+
Action: cliutil.ErrorHandler(installLaunchd),
2829
},
2930
{
3031
Name: "uninstall",
3132
Usage: "Uninstall the Argo Tunnel launch agent",
32-
Action: uninstallLaunchd,
33+
Action: cliutil.ErrorHandler(uninstallLaunchd),
3334
},
3435
},
3536
})

cmd/cloudflared/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func commands(version func(c *cli.Context)) []*cli.Command {
8888
cmds := []*cli.Command{
8989
{
9090
Name: "update",
91-
Action: updater.Update,
91+
Action: cliutil.ErrorHandler(updater.Update),
9292
Usage: "Update the agent if a new version exists",
9393
ArgsUsage: " ",
9494
Description: `Looks for a new version on the official download server.

0 commit comments

Comments
 (0)