feat: enhance development experience by improving watch options for domain package and refining error logging in Japan Post Address Service
This commit is contained in:
parent
971cde9d05
commit
7624684e6b
@ -15,8 +15,8 @@
|
||||
"dev:build:watch": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
||||
"dev:alias": "tsc-alias -p tsconfig.build.json --resolve-full-paths",
|
||||
"dev:alias:watch": "tsc-alias -p tsconfig.build.json --resolve-full-paths -w",
|
||||
"dev:run:watch": "node --watch dist/main.js",
|
||||
"dev:run:debug:watch": "node --inspect --watch dist/main.js",
|
||||
"dev:run:watch": "node --watch --watch-path=dist --watch-path=../../packages/domain/dist dist/main.js",
|
||||
"dev:run:debug:watch": "node --inspect --watch --watch-path=dist --watch-path=../../packages/domain/dist dist/main.js",
|
||||
"start:debug": "BFF_NODE_RUN_SCRIPT=dev:run:debug:watch bash ./scripts/dev-watch.sh",
|
||||
"start:prod": "node dist/main.js",
|
||||
"lint": "eslint .",
|
||||
|
||||
@ -79,18 +79,25 @@ export class JapanPostAddressService {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Check if this is an HTTP error from connection layer (already logged there)
|
||||
// Get raw error message for classification
|
||||
const rawMessage = error instanceof Error ? error.message : String(error);
|
||||
const errorMessage = extractErrorMessage(error);
|
||||
const isConnectionError = errorMessage.includes("HTTP") || errorMessage.includes("timed out");
|
||||
|
||||
// Check if this is an HTTP/connection error (already logged at connection layer)
|
||||
const isConnectionError =
|
||||
rawMessage.includes("HTTP") ||
|
||||
rawMessage.includes("timed out") ||
|
||||
rawMessage.includes("failed") ||
|
||||
errorMessage.includes("HTTP") ||
|
||||
errorMessage.includes("timed out");
|
||||
|
||||
if (!isConnectionError) {
|
||||
// Only log unexpected errors (e.g., transformation failures)
|
||||
this.logger.error("Address lookup failed at service layer", {
|
||||
this.logger.error("Address lookup transformation error", {
|
||||
zipCode: normalizedZip,
|
||||
durationMs,
|
||||
errorType: error instanceof Error ? error.constructor.name : "Unknown",
|
||||
error: errorMessage,
|
||||
stage: "response_transformation",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -23,11 +23,28 @@ const nextConfig = {
|
||||
},
|
||||
},
|
||||
|
||||
webpack(config) {
|
||||
webpack(config, { dev }) {
|
||||
config.resolve.alias = {
|
||||
...config.resolve.alias,
|
||||
"@customer-portal/domain": path.join(workspaceRoot, "packages/domain/dist"),
|
||||
};
|
||||
|
||||
// Watch domain package dist for changes in development
|
||||
if (dev) {
|
||||
config.watchOptions = {
|
||||
...config.watchOptions,
|
||||
ignored: config.watchOptions?.ignored
|
||||
? [...(Array.isArray(config.watchOptions.ignored) ? config.watchOptions.ignored : [config.watchOptions.ignored])]
|
||||
.filter(p => !String(p).includes("packages/domain"))
|
||||
: ["**/node_modules/**"],
|
||||
};
|
||||
// Add domain dist to snapshot managed paths for better change detection
|
||||
config.snapshot = {
|
||||
...config.snapshot,
|
||||
managedPaths: [],
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user