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:
Matthew Raymer
2025-04-07 07:29:52 +00:00
parent 17c9c22741
commit a3f7b651d2
7 changed files with 22 additions and 24 deletions

View File

@@ -130,7 +130,7 @@ export default class PhotoDialog extends Vue {
try {
const settings = await retrieveSettingsForActiveAccount();
this.activeDid = settings.activeDid || "";
} catch (err: any) {
} catch (err: unknown) {
logger.error("Error retrieving settings from database:", err);
this.$notify(
{
@@ -184,7 +184,7 @@ export default class PhotoDialog extends Vue {
const result = await this.platformService.takePicture();
this.blob = result.blob;
this.fileName = result.fileName;
} catch (error) {
} catch (error: unknown) {
logger.error("Error taking picture:", error);
this.$notify(
{
@@ -203,7 +203,7 @@ export default class PhotoDialog extends Vue {
const result = await this.platformService.pickImage();
this.blob = result.blob;
this.fileName = result.fileName;
} catch (error) {
} catch (error: unknown) {
logger.error("Error picking image:", error);
this.$notify(
{
@@ -270,7 +270,7 @@ export default class PhotoDialog extends Vue {
this.close();
this.setImageCallback(response.data.url as string);
} catch (error) {
} catch (error: unknown) {
// Log the raw error first
logger.error("Raw error object:", JSON.stringify(error, null, 2));