-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathroast_config_exceptions.dart
More file actions
69 lines (59 loc) · 1.73 KB
/
roast_config_exceptions.dart
File metadata and controls
69 lines (59 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/// Custom exceptions for ROAST group configuration export/import operations
library roast_config_exceptions;
/// Base exception class for ROAST configuration operations
abstract class ROASTConfigException implements Exception {
final String message;
final String? details;
const ROASTConfigException(this.message, {this.details});
@override
String toString() {
if (details != null) {
return 'ROASTConfigException: $message\nDetails: $details';
}
return 'ROASTConfigException: $message';
}
}
/// Exception thrown when YAML format is invalid or cannot be parsed
class InvalidYAMLFormatException extends ROASTConfigException {
const InvalidYAMLFormatException(
super.message, {
super.details,
});
}
/// Exception thrown when file operations fail
class FileOperationException extends ROASTConfigException {
final String operation;
final String? filePath;
const FileOperationException(
this.operation,
super.message, {
this.filePath,
super.details,
});
@override
String toString() {
String result = 'FileOperationException: $message\nOperation: $operation';
if (filePath != null) {
result += '\nFile: $filePath';
}
return result;
}
}
/// Exception thrown when configuration validation fails
class ConfigValidationException extends ROASTConfigException {
final List<String> validationErrors;
const ConfigValidationException(
super.message,
this.validationErrors, {
super.details,
});
@override
String toString() {
String result = 'ConfigValidationException: $message';
if (validationErrors.isNotEmpty) {
result +=
'\nValidation errors:\n${validationErrors.map((e) => ' - $e').join('\n')}';
}
return result;
}
}