mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-26 15:16:59 +00:00
feat: implement platform provider architecture and integrate into AppRoot
- Introduced a new platform provider architecture to manage platform-specific functionalities. - Created `PlatformProvider`, `PlatformContext`, and related capabilities for handling downloads and key imports. - Integrated the platform provider into `AppRoot`, allowing for dynamic platform management. - Added error handling classes for unsupported and unimplemented methods. - Updated tests to validate the new platform provider functionalities and capabilities.
This commit is contained in:
1 parent
d86323e38a
commit
cc688b85bd
13 files changed
+483
-45
No files matched your search
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Thrown when a provider method is declared or expected but not wired yet.
|
||||
* Distinct from {@link NotSupportedMethod} (platform does not support this call).
|
||||
*/
|
||||
export class NotImplementedError extends Error {
|
||||
readonly code = 'NOT_IMPLEMENTED' as const;
|
||||
|
||||
constructor(
|
||||
readonly capability: string,
|
||||
message?: string,
|
||||
) {
|
||||
super(message ?? `Capability not implemented: ${capability}`);
|
||||
this.name = 'NotImplementedError';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown when the current platform explicitly does not support a method / mode
|
||||
* (e.g. Browser `keys.importNative`, or `saveMany(DirectWrite)` when not in `downloadTypes`).
|
||||
* Callers should use `instanceof` / `code` — never treat as a silent no-op.
|
||||
*/
|
||||
export class NotSupportedMethod extends Error {
|
||||
readonly code = 'NOT_SUPPORTED' as const;
|
||||
|
||||
constructor(
|
||||
readonly capability: string,
|
||||
message?: string,
|
||||
) {
|
||||
super(message ?? `Capability not supported: ${capability}`);
|
||||
this.name = 'NotSupportedMethod';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user