refactor: improve camera controls and modularize data export

- Add detailed error logging for image upload failures in PhotoDialog and SharedPhotoView
- Extract DataExportSection into standalone component with proper prop handling
- Fix Backup Identifier Seed visibility by passing activeDid prop
This commit is contained in:
Matthew Raymer
2025-04-07 07:17:43 +00:00
parent c8eb72ba52
commit 17c9c22741
4 changed files with 139 additions and 67 deletions

View File

@@ -273,14 +273,14 @@ export default class PhotoDialog extends Vue {
} catch (error) {
// Log the raw error first
logger.error("Raw error object:", JSON.stringify(error, null, 2));
let errorMessage = "There was an error saving the picture.";
if (axios.isAxiosError(error)) {
const status = error.response?.status;
const statusText = error.response?.statusText;
const data = error.response?.data;
// Log detailed error information
logger.error("Upload error details:", {
status,
@@ -290,16 +290,17 @@ export default class PhotoDialog extends Vue {
config: {
url: error.config?.url,
method: error.config?.method,
headers: error.config?.headers
}
headers: error.config?.headers,
},
});
if (status === 401) {
errorMessage = "Authentication failed. Please try logging in again.";
} else if (status === 413) {
errorMessage = "Image file is too large. Please try a smaller image.";
} else if (status === 415) {
errorMessage = "Unsupported image format. Please try a different image.";
errorMessage =
"Unsupported image format. Please try a different image.";
} else if (status && status >= 500) {
errorMessage = "Server error. Please try again later.";
} else if (data?.message) {
@@ -311,16 +312,16 @@ export default class PhotoDialog extends Vue {
name: error.name,
message: error.message,
stack: error.stack,
error: JSON.stringify(error, Object.getOwnPropertyNames(error), 2)
error: JSON.stringify(error, Object.getOwnPropertyNames(error), 2),
});
} else {
// Log any other type of error
logger.error("Unknown error type:", {
error: JSON.stringify(error, null, 2),
type: typeof error
type: typeof error,
});
}
this.$notify(
{
group: "alert",