Skip to content

Commit c5aac6d

Browse files
committed
Remove try..catch
1 parent 9384630 commit c5aac6d

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/client/datascience/notebook/notebookTrustHandler.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,18 @@ export class NotebookTrustHandler implements IExtensionSingleActivationService {
6363
DataScience.launchNotebookTrustPrompt(),
6464
...prompts
6565
);
66-
if (!selection) {
66+
if (selection !== DataScience.trustNotebook() || model.isTrusted) {
6767
return;
6868
}
69-
if (model && selection === DataScience.trustNotebook() && !model.isTrusted) {
70-
try {
71-
const contents = model.getContent();
72-
await this.trustService.trustNotebook(model.file, contents);
73-
// Update model trust
74-
model.update({
75-
source: 'user',
76-
kind: 'updateTrust',
77-
oldDirty: model.isDirty,
78-
newDirty: model.isDirty,
79-
isNotebookTrusted: true
80-
});
81-
} catch (err) {
82-
traceError(err);
83-
}
84-
}
69+
const contents = model.getContent();
70+
await this.trustService.trustNotebook(model.file, contents);
71+
// Update model trust
72+
model.update({
73+
source: 'user',
74+
kind: 'updateTrust',
75+
oldDirty: model.isDirty,
76+
newDirty: model.isDirty,
77+
isNotebookTrusted: true
78+
});
8579
}
8680
}

0 commit comments

Comments
 (0)