Skip to content

Commit 917fafd

Browse files
authored
Merge pull request #3387 from numbersprotocol/copilot/add-content-security-policy-error-handling
Add Content Security Policy and fix silent error swallowing in subscribe calls
2 parents 991f555 + 82151a4 commit 917fafd

5 files changed

Lines changed: 59 additions & 16 deletions

File tree

src/app/features/contacts/contacts.page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ export class ContactsPage {
4646
catchError((err: unknown) => this.errorService.toastError$(err)),
4747
untilDestroyed(this)
4848
)
49-
.subscribe();
49+
.subscribe({
50+
// eslint-disable-next-line no-console
51+
error: (err: unknown) => console.error(err),
52+
});
5053
}
5154

5255
// eslint-disable-next-line class-methods-use-this

src/app/features/data-policy/data-policy.page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export class DataPolicyPage {
4444
}),
4545
untilDestroyed(this)
4646
)
47-
.subscribe();
47+
.subscribe({
48+
// eslint-disable-next-line no-console
49+
error: (err: unknown) => console.error(err),
50+
});
4851
}
4952
}

src/app/features/signup/signup.page.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ export class SignupPage {
7070
),
7171
untilDestroyed(this)
7272
)
73-
.subscribe();
73+
.subscribe({
74+
// eslint-disable-next-line no-console
75+
error: (err: unknown) => console.error(err),
76+
});
7477
}
7578

7679
private createFormFields(
@@ -237,7 +240,10 @@ export class SignupPage {
237240
this.blockingActionService
238241
.run$(action$)
239242
.pipe(untilDestroyed(this))
240-
.subscribe();
243+
.subscribe({
244+
// eslint-disable-next-line no-console
245+
error: (err: unknown) => console.error(err),
246+
});
241247
}
242248

243249
private handleOnSubmitError(err: unknown) {

src/app/features/wallets/transfer/transfer.page.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ export class TransferPage {
6565
private readonly platform: Platform,
6666
private readonly snackBar: MatSnackBar
6767
) {
68-
this.activeRoute.paramMap.subscribe(paramMap => {
69-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70-
this.mode = paramMap.get('mode')!;
68+
this.activeRoute.paramMap.subscribe({
69+
next: paramMap => {
70+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71+
this.mode = paramMap.get('mode')!;
72+
},
73+
// eslint-disable-next-line no-console
74+
error: (err: unknown) => console.error(err),
7175
});
7276
}
7377

@@ -84,7 +88,10 @@ export class TransferPage {
8488
),
8589
untilDestroyed(this)
8690
)
87-
.subscribe();
91+
.subscribe({
92+
// eslint-disable-next-line no-console
93+
error: (err: unknown) => console.error(err),
94+
});
8895
}
8996

9097
onInputTransferAmount() {
@@ -98,7 +105,10 @@ export class TransferPage {
98105
this.translocoService.translate('error.wallets.emptyTransferAmount')
99106
)
100107
.pipe(untilDestroyed(this))
101-
.subscribe();
108+
.subscribe({
109+
// eslint-disable-next-line no-console
110+
error: (err: unknown) => console.error(err),
111+
});
102112
return;
103113
}
104114

@@ -156,7 +166,10 @@ export class TransferPage {
156166
}),
157167
untilDestroyed(this)
158168
)
159-
.subscribe();
169+
.subscribe({
170+
// eslint-disable-next-line no-console
171+
error: (err: unknown) => console.error(err),
172+
});
160173
}
161174

162175
transfer() {
@@ -180,7 +193,10 @@ export class TransferPage {
180193
finalize(() => dialogRef.close()),
181194
untilDestroyed(this)
182195
)
183-
.subscribe();
196+
.subscribe({
197+
// eslint-disable-next-line no-console
198+
error: (err: unknown) => console.error(err),
199+
});
184200
}
185201

186202
openTransferRequestSentDialog() {

src/app/features/wallets/wallets.page.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ export class WalletsPage {
9090
}),
9191
untilDestroyed(this)
9292
)
93-
.subscribe();
93+
.subscribe({
94+
// eslint-disable-next-line no-console
95+
error: (err: unknown) => console.error(err),
96+
});
9497
}
9598

9699
private reloadPage() {
@@ -103,7 +106,10 @@ export class WalletsPage {
103106
}),
104107
untilDestroyed(this)
105108
)
106-
.subscribe();
109+
.subscribe({
110+
// eslint-disable-next-line no-console
111+
error: (err: unknown) => console.error(err),
112+
});
107113
}
108114

109115
private copyToClipboardAssetWallet() {
@@ -113,7 +119,10 @@ export class WalletsPage {
113119
concatMap(assetWalletAddr => this.copyToClipboard(assetWalletAddr)),
114120
untilDestroyed(this)
115121
)
116-
.subscribe();
122+
.subscribe({
123+
// eslint-disable-next-line no-console
124+
error: (err: unknown) => console.error(err),
125+
});
117126
}
118127

119128
private copyToClipboardIntegrityWallet() {
@@ -123,7 +132,10 @@ export class WalletsPage {
123132
concatMap(publicKey => this.copyToClipboard(publicKey)),
124133
untilDestroyed(this)
125134
)
126-
.subscribe();
135+
.subscribe({
136+
// eslint-disable-next-line no-console
137+
error: (err: unknown) => console.error(err),
138+
});
127139
}
128140

129141
private copyToClipboardPrivateKey() {
@@ -133,7 +145,10 @@ export class WalletsPage {
133145
concatMap(privateKey => this.copyToClipboard(privateKey)),
134146
untilDestroyed(this)
135147
)
136-
.subscribe();
148+
.subscribe({
149+
// eslint-disable-next-line no-console
150+
error: (err: unknown) => console.error(err),
151+
});
137152
}
138153

139154
navigateToBuyNumPage() {

0 commit comments

Comments
 (0)