Skip to content

Commit

Permalink
refactor: return reload status
Browse files Browse the repository at this point in the history
  • Loading branch information
joacoc committed Nov 7, 2023
1 parent b87f251 commit 3f5147c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/context/asyncContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ export default class AsyncContext extends Context {
try {
await this.config.addAndSaveProfile(name, appPassword, region);
try {
await this.reloadContext();
const success = await this.reloadContext();
return success;
} catch (err) {
this.handleErr(err, "Error reloading context.");
}
Expand All @@ -277,9 +278,11 @@ export default class AsyncContext extends Context {
async removeAndSaveProfile(name: string) {
try {
this.config.removeAndSaveProfile(name);
await this.reloadContext();
const success = await this.reloadContext();
return success;
} catch (err) {
this.handleErr(err, "Error reloading context.");
return false;
}
}

Expand Down Expand Up @@ -414,8 +417,8 @@ export default class AsyncContext extends Context {
}

try {
await this.reloadEnvironment(true);
return true;
const success = await this.reloadEnvironment(true);
return success;
} catch (err) {
this.handleErr(err as Error, "Error reloading environment.");
return false;
Expand All @@ -436,8 +439,8 @@ export default class AsyncContext extends Context {
}

try {
await this.reloadEnvironment();
return true;
const success = await this.reloadEnvironment();
return success;
} catch (err) {
this.handleErr(err as Error, "Error reloading environment.");
return false;
Expand All @@ -458,8 +461,8 @@ export default class AsyncContext extends Context {
}

try {
await this.reloadEnvironment();
return true;
const success = await this.reloadEnvironment();
return success;
} catch (err) {
this.handleErr(err as Error, "Error reloading environment.");
return false;
Expand Down

0 comments on commit 3f5147c

Please sign in to comment.