refactor: Replace console logging with logger utility
- Add logger import across multiple view components - Replace console.error/warn/log with logger methods - Update error handling to use structured logging - Improve type safety for error objects - Add crypto-browserify polyfill for browser environment The changes improve logging by: 1. Using consistent logging interface 2. Adding structured error logging 3. Improving error type safety 4. Centralizing logging configuration 5. Fixing browser compatibility issues Affected files: - Multiple view components - vite.config.ts - Build configuration
This commit is contained in:
@@ -192,7 +192,7 @@ import {
|
||||
} from "../libs/endorserServer";
|
||||
import * as libsUtil from "../libs/util";
|
||||
import { retrieveAccountDids } from "../libs/util";
|
||||
|
||||
import { logger } from "../utils/logger";
|
||||
/**
|
||||
* Offer Details View Component
|
||||
* @author Matthew Raymer
|
||||
@@ -303,8 +303,8 @@ export default class OfferDetailsView extends Vue {
|
||||
await this.loadAccountSettings();
|
||||
await this.loadRecipientInfo();
|
||||
await this.loadProjectInfo();
|
||||
} catch (err: any) {
|
||||
console.error("Error in mounted:", err);
|
||||
} catch (err: unknown) {
|
||||
logger.error("Error in mounted:", err);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -328,7 +328,7 @@ export default class OfferDetailsView extends Vue {
|
||||
this.$route.query["prevCredToEdit"] as string,
|
||||
) as GenericCredWrapper<OfferVerifiableCredential>)
|
||||
: undefined;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -687,7 +687,7 @@ export default class OfferDetailsView extends Vue {
|
||||
|
||||
if (result.type === "error" || this.isCreationError(result.response)) {
|
||||
const errorMessage = this.getCreationErrorMessage(result);
|
||||
console.error("Error with offer creation result:", result);
|
||||
logger.error("Error with offer creation result:", result);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -716,7 +716,7 @@ export default class OfferDetailsView extends Vue {
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
console.error("Error with offer recordation caught:", error);
|
||||
logger.error("Error with offer recordation caught:", error);
|
||||
const errorMessage =
|
||||
error.userMessage ||
|
||||
error.response?.data?.error?.message ||
|
||||
|
||||
Reference in New Issue
Block a user