Skip to content

Commit 00cd74a

Browse files
author
Zheyu Shen
committed
avoid catching at top level to improve debug experience
1 parent 0f3464f commit 00cd74a

File tree

1 file changed

+8
-16
lines changed
  • Scheduler/HPCSchedulerBasics/HPCSchedulerBasics

1 file changed

+8
-16
lines changed

Scheduler/HPCSchedulerBasics/HPCSchedulerBasics/Program.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,17 @@ static int Main(string[] args)
7373
// Create a scheduler object to be used to
7474
// establish a connection to the scheduler on the headnode
7575
using IScheduler scheduler = new Scheduler();
76-
try
76+
if (userName != null)
7777
{
78-
if (userName != null)
79-
{
80-
// Connect to the scheduler as another user
81-
Console.WriteLine("Connecting to {0} as {1}...", clusterName, userName);
82-
scheduler.ConnectServiceAsClient(clusterName, () => userName);
83-
}
84-
else
85-
{
86-
// Connect to the scheduler
87-
Console.WriteLine("Connecting to {0}...", clusterName);
88-
scheduler.Connect(clusterName);
89-
}
78+
// Connect to the scheduler as another user
79+
Console.WriteLine("Connecting to {0} as {1}...", clusterName, userName);
80+
scheduler.ConnectServiceAsClient(clusterName, () => userName);
9081
}
91-
catch (Exception e)
82+
else
9283
{
93-
Console.Error.WriteLine("Could not connect to the scheduler: {0}", e.Message);
94-
return 1; //abort if no connection could be made
84+
// Connect to the scheduler
85+
Console.WriteLine("Connecting to {0}...", clusterName);
86+
scheduler.Connect(clusterName);
9587
}
9688

9789
//Create a job to submit to the scheduler

0 commit comments

Comments
 (0)