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:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user