feat: suppress console spam for expected HTTP errors in profile operations
- Change server switching logs from info to debug level - Implement structured error logging for profile CRUD operations - Handle HTTP status codes 400, 401, 403, 404, 409 gracefully - Suppress full error stack traces for expected API responses - Maintain user notifications while improving console readability - Add timestamp and context to all profile-related error logs Improves developer experience by reducing console noise while preserving debugging information and user-facing error handling.
This commit is contained in:
@@ -282,6 +282,7 @@ import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import { NOTIFY_CONTACT_LOADING_ISSUE } from "@/constants/notifications";
|
||||
import * as Package from "../../package.json";
|
||||
import { UNNAMED_ENTITY_NAME } from "@/constants/entities";
|
||||
|
||||
// consolidate this with GiveActionClaim in src/interfaces/claims.ts
|
||||
interface Claim {
|
||||
@@ -1563,30 +1564,41 @@ export default class HomeView extends Vue {
|
||||
* @param giver Optional contact info for giver
|
||||
* @param description Optional gift description
|
||||
*/
|
||||
openDialog(giver?: GiverReceiverInputInfo | "Unnamed", prompt?: string) {
|
||||
if (giver === "Unnamed") {
|
||||
// Special case: Pass undefined to trigger Step 1, but with "Unnamed" pre-selected
|
||||
(this.$refs.giftedDialog as GiftedDialog).open(
|
||||
undefined,
|
||||
{
|
||||
did: this.activeDid,
|
||||
name: "You",
|
||||
} as GiverReceiverInputInfo,
|
||||
undefined,
|
||||
prompt,
|
||||
);
|
||||
// Immediately select "Unnamed" and move to Step 2
|
||||
(this.$refs.giftedDialog as GiftedDialog).selectGiver();
|
||||
openDialog(giver?: GiverReceiverInputInfo, prompt?: string) {
|
||||
// Determine the giver entity based on DID logic
|
||||
const giverEntity = this.createGiverEntity(giver);
|
||||
|
||||
(this.$refs.giftedDialog as GiftedDialog).open(
|
||||
giverEntity,
|
||||
{
|
||||
did: this.activeDid,
|
||||
name: "You", // In HomeView, we always use "You" as the giver
|
||||
} as GiverReceiverInputInfo,
|
||||
undefined,
|
||||
prompt,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates giver entity using DID-based logic
|
||||
*/
|
||||
private createGiverEntity(
|
||||
giver?: GiverReceiverInputInfo,
|
||||
): GiverReceiverInputInfo | undefined {
|
||||
if (!giver) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Handle GiverReceiverInputInfo object
|
||||
if (giver.did === this.activeDid) {
|
||||
// If DID matches active DID, create "You" entity
|
||||
return { did: this.activeDid, name: "You" };
|
||||
} else if (!giver.did || giver.did === "") {
|
||||
// If DID is empty/null, create "Unnamed" entity
|
||||
return { did: "", name: UNNAMED_ENTITY_NAME };
|
||||
} else {
|
||||
(this.$refs.giftedDialog as GiftedDialog).open(
|
||||
giver,
|
||||
{
|
||||
did: this.activeDid,
|
||||
name: "You",
|
||||
} as GiverReceiverInputInfo,
|
||||
undefined,
|
||||
prompt,
|
||||
);
|
||||
// Return the giver as-is
|
||||
return giver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1649,10 +1661,15 @@ export default class HomeView extends Vue {
|
||||
this.isImageViewerOpen = true;
|
||||
}
|
||||
|
||||
openPersonDialog(
|
||||
giver?: GiverReceiverInputInfo | "Unnamed",
|
||||
prompt?: string,
|
||||
) {
|
||||
private handleQRCodeClick() {
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
this.$router.push({ name: "contact-qr-scan-full" });
|
||||
} else {
|
||||
this.$router.push({ name: "contact-qr" });
|
||||
}
|
||||
}
|
||||
|
||||
openPersonDialog(giver?: GiverReceiverInputInfo, prompt?: string) {
|
||||
this.showProjectsDialog = false;
|
||||
this.openDialog(giver, prompt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user