feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/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()),
|
||||
};
|
||||
Reference in new issue
Block a user