mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-22 17:51:29 +03:00
Add extra checks related to flags
This commit is contained in:
parent
e3d216daa0
commit
556be0dbda
@ -28,6 +28,7 @@ import 'package:logging/logging.dart';
|
||||
import 'package:screen_retriever/screen_retriever.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:yubico_authenticator/exception/initialization_exception.dart';
|
||||
|
||||
import '../app/app.dart';
|
||||
import '../app/logging.dart';
|
||||
@ -247,6 +248,10 @@ void _initLogging(List<String> argv) {
|
||||
File? file;
|
||||
if (logFileIndex != -1) {
|
||||
final path = argv[logFileIndex + 1];
|
||||
if (path.isEmpty) {
|
||||
throw InitializationException(
|
||||
'USAGE: Missing argument for option --log-file');
|
||||
}
|
||||
file = File(path);
|
||||
}
|
||||
Logger.root.onRecord.listen((record) {
|
||||
|
21
lib/exception/initialization_exception.dart
Normal file
21
lib/exception/initialization_exception.dart
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Yubico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class InitializationException implements Exception {
|
||||
final String message;
|
||||
|
||||
InitializationException(this.message);
|
||||
}
|
Loading…
Reference in New Issue
Block a user