fix: improve error handling in photo upload
- Add proper unknown type for error handling in PhotoDialog - Remove any type in favor of unknown for better type safety - Fix error message access with type guards
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Capacitor } from "@capacitor/core";
|
||||
import { PlatformService } from "./PlatformService";
|
||||
import { WebPlatformService } from "./platforms/WebPlatformService";
|
||||
import { CapacitorPlatformService } from "./platforms/CapacitorPlatformService";
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { ImageResult, PlatformService } from "../PlatformService";
|
||||
import { Capacitor } from "@capacitor/core";
|
||||
import { Filesystem, Directory } from "@capacitor/filesystem";
|
||||
import { Camera, CameraResultType, CameraSource } from "@capacitor/camera";
|
||||
import { App } from "@capacitor/app";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
export class CapacitorPlatformService implements PlatformService {
|
||||
@@ -113,7 +111,7 @@ export class CapacitorPlatformService implements PlatformService {
|
||||
return false;
|
||||
}
|
||||
|
||||
async handleDeepLink(url: string): Promise<void> {
|
||||
async handleDeepLink(_url: string): Promise<void> {
|
||||
// Capacitor handles deep links automatically
|
||||
// This is just a placeholder for the interface
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -2,19 +2,19 @@ import { ImageResult, PlatformService } from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
export class ElectronPlatformService implements PlatformService {
|
||||
async readFile(path: string): Promise<string> {
|
||||
async readFile(_path: string): Promise<string> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async writeFile(path: string, content: string): Promise<void> {
|
||||
async writeFile(_path: string, _content: string): Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async deleteFile(path: string): Promise<void> {
|
||||
async deleteFile(_path: string): Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async listFiles(directory: string): Promise<string[]> {
|
||||
async listFiles(_directory: string): Promise<string[]> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export class ElectronPlatformService implements PlatformService {
|
||||
return false;
|
||||
}
|
||||
|
||||
async handleDeepLink(url: string): Promise<void> {
|
||||
async handleDeepLink(_url: string): Promise<void> {
|
||||
logger.error("handleDeepLink not implemented in Electron platform");
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@ import { ImageResult, PlatformService } from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
export class PyWebViewPlatformService implements PlatformService {
|
||||
async readFile(path: string): Promise<string> {
|
||||
async readFile(_path: string): Promise<string> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async writeFile(path: string, content: string): Promise<void> {
|
||||
async writeFile(_path: string, _content: string): Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async deleteFile(path: string): Promise<void> {
|
||||
async deleteFile(_path: string): Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
async listFiles(directory: string): Promise<string[]> {
|
||||
async listFiles(_directory: string): Promise<string[]> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export class PyWebViewPlatformService implements PlatformService {
|
||||
return false;
|
||||
}
|
||||
|
||||
async handleDeepLink(url: string): Promise<void> {
|
||||
async handleDeepLink(_url: string): Promise<void> {
|
||||
logger.error("handleDeepLink not implemented in PyWebView platform");
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@ import { ImageResult, PlatformService } from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
export class WebPlatformService implements PlatformService {
|
||||
async readFile(path: string): Promise<string> {
|
||||
async readFile(_path: string): Promise<string> {
|
||||
throw new Error("File system access not available in web platform");
|
||||
}
|
||||
|
||||
async writeFile(path: string, content: string): Promise<void> {
|
||||
async writeFile(_path: string, _content: string): Promise<void> {
|
||||
throw new Error("File system access not available in web platform");
|
||||
}
|
||||
|
||||
async deleteFile(path: string): Promise<void> {
|
||||
async deleteFile(_path: string): Promise<void> {
|
||||
throw new Error("File system access not available in web platform");
|
||||
}
|
||||
|
||||
async listFiles(directory: string): Promise<string[]> {
|
||||
async listFiles(_directory: string): Promise<string[]> {
|
||||
throw new Error("File system access not available in web platform");
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ export class WebPlatformService implements PlatformService {
|
||||
return true;
|
||||
}
|
||||
|
||||
async handleDeepLink(url: string): Promise<void> {
|
||||
async handleDeepLink(_url: string): Promise<void> {
|
||||
// Web platform can handle deep links through URL parameters
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user