Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
61 lines
2.2 KiB
Dart
61 lines
2.2 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cutdex_core/editor.dart';
|
|
import 'package:cutdex_core/project.dart';
|
|
|
|
import '../errors/app_failure.dart';
|
|
|
|
/// Adapts SDK errors by code. Unknown errors retain their complete diagnostics.
|
|
AppFailure appFailureFromError(Object error) {
|
|
if (error is AppException) return error.failure;
|
|
if (error is AppFailure) return error;
|
|
final AppErrorCode code;
|
|
switch (error) {
|
|
case CommandRejected(:final code):
|
|
final mapped = switch (code) {
|
|
'missingMedia' => AppErrorCode.mediaNoLongerExists,
|
|
'staleVersion' ||
|
|
'invalidSelection' ||
|
|
'missingClip' => AppErrorCode.timelineChanged,
|
|
'missingTimeline' ||
|
|
'timelineNotOpen' => AppErrorCode.openTimelineFailed,
|
|
'projectNotOpen' => AppErrorCode.openMatchingProject,
|
|
'missingProject' => AppErrorCode.openProjectFirst,
|
|
'projectIdMismatch' => AppErrorCode.projectMismatch,
|
|
'unsupported' ||
|
|
'unavailable' ||
|
|
'busy' ||
|
|
'cancelled' ||
|
|
'workspaceBusy' ||
|
|
'projectCreationFailed' ||
|
|
'invalidArguments' => AppErrorCode.operationFailed,
|
|
_ => AppErrorCode.diagnostic,
|
|
};
|
|
return AppFailure(mapped, diagnostic: error.toString());
|
|
case ProjectFileException(:final code):
|
|
final mapped = switch (code) {
|
|
ProjectFileError.notFound => AppErrorCode.projectMissingDirectory,
|
|
ProjectFileError.closed => AppErrorCode.projectSessionClosed,
|
|
ProjectFileError.conflict => AppErrorCode.projectMismatch,
|
|
_ => AppErrorCode.projectAccessFailed,
|
|
};
|
|
return AppFailure(mapped, diagnostic: error.toString());
|
|
default:
|
|
code = AppErrorCode.diagnostic;
|
|
}
|
|
return AppFailure(code, diagnostic: error.toString());
|
|
}
|
|
|
|
/// Project operations provide context for otherwise unclassified I/O failures.
|
|
AppFailure projectFailureFromError(Object error) => switch (error) {
|
|
FileSystemException() => AppFailure(
|
|
AppErrorCode.projectAccessFailed,
|
|
diagnostic: error.toString(),
|
|
),
|
|
AppException() ||
|
|
CommandRejected() ||
|
|
ProjectFileException() ||
|
|
StateError() => appFailureFromError(error),
|
|
_ => AppFailure(AppErrorCode.operationFailed, diagnostic: error.toString()),
|
|
};
|