Skip to content

Commit

Permalink
feat(init): catch and log errors when lauching gdm session
Browse files Browse the repository at this point in the history
  • Loading branch information
d-loose committed Feb 16, 2024
1 parent fa7d5fe commit eb2da35
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/ubuntu_init/lib/src/init_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import 'dart:async';

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:ubuntu_init/ubuntu_init.dart';
import 'package:ubuntu_logger/ubuntu_logger.dart';
import 'package:ubuntu_provision/ubuntu_provision.dart';
import 'package:ubuntu_service/ubuntu_service.dart';

final _log = Logger('init_model');

final initModelProvider = Provider(
(_) => InitModel(
pageConfig: tryGetService<PageConfigService>(),
Expand Down Expand Up @@ -37,11 +40,15 @@ class InitModel {
final identity = await _identityService?.getIdentity();
if (identity == null) return;

await _gdmService?.init();
await _gdmService?.launchSession(
identity.username,
identity.password,
);
try {
await _gdmService?.init();
await _gdmService?.launchSession(
identity.username,
identity.password,
);
} on Exception catch (e) {
_log.error('Failed to launch desktop session', e);
}
}

bool hasRoute(String route) {
Expand Down

0 comments on commit eb2da35

Please sign in to comment.