Skip to content

Commit 42f5d70

Browse files
committed
fix(drivers): improve error handling for recompile and reload
1 parent 2924d28 commit 42f5d70

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/app/drivers/driver-state.service.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,18 @@ export class DriverStateService {
140140
);
141141
if (!details || !details.reason) return details.close();
142142
details.loading('Recompiling driver... This may take a while.');
143-
const success = await recompileDriver(item.id)
143+
await recompileDriver(item.id)
144144
.toPromise()
145-
.catch(() => false);
146-
if (success === false) {
147-
notifyError('Failed to recompile driver.');
148-
}
145+
.catch(async (e) => {
146+
console.log('Error:', e);
147+
const content = e instanceof Response ? await e.text() : e;
148+
notifyError('Failed to recompile driver.', 'View Error', () =>
149+
this._dialog.open<ViewResponseModalComponent>(
150+
ViewResponseModalComponent,
151+
{ data: { content } },
152+
),
153+
);
154+
});
149155
details.close();
150156
}
151157

@@ -165,7 +171,9 @@ export class DriverStateService {
165171
.toPromise()
166172
.catch(() => false);
167173
if (success === false) {
168-
notifyError('Failed to reload driver.');
174+
notifyError(
175+
'Failed to reload driver. Driver may not be compiled. Try recompiling first.',
176+
);
169177
} else {
170178
notifySuccess('Successfully reloaded driver.');
171179
}

src/app/overlays/confirm-modal.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export async function openConfirmModal(
9494
} @else {
9595
<main loading>
9696
<div
97-
class="flex h-48 w-full flex-col items-center justify-center space-y-4"
97+
class="flex h-48 w-full flex-col items-center justify-center space-y-4 p-12"
9898
>
9999
<mat-spinner diameter="32"></mat-spinner>
100100
<p>{{ loading() }}</p>

0 commit comments

Comments
 (0)