Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions src/models/controller.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ export class Controller {

res.status(200).send(responseContacts);
} catch (error) {
// prevent logging of refresh errors
// prevent logging of integration errors that are forwarded to the client
if (
error instanceof ServerError &&
error.message === IntegrationErrorType.INTEGRATION_REFRESH_ERROR
error.message in IntegrationErrorType
) {
next(error);
return;
Expand Down Expand Up @@ -185,17 +185,18 @@ export class Controller {
}
}
} catch (error) {
// prevent logging of refresh errors
// prevent logging of integration errors that are forwarded to the client
if (
error instanceof ServerError &&
error.message === IntegrationErrorType.INTEGRATION_REFRESH_ERROR
error.message in IntegrationErrorType
) {
next(error);
return;
}

console.error(
errorLogger(
`[${anonymizeKey(apiKey)}] Could not create contact`,
req.providerConfig,
error || "Unknown"
);
next(error);
Expand Down Expand Up @@ -252,16 +253,20 @@ export class Controller {
}
}
} catch (error) {
// prevent logging of refresh errors
// prevent logging of integration errors that are forwarded to the client
if (
error instanceof ServerError &&
error.message === IntegrationErrorType.INTEGRATION_REFRESH_ERROR
error.message in IntegrationErrorType
) {
next(error);
return;
}

console.error("Could not update contact:", error || "Unknown");
errorLogger(
"Could not update contact:",
req.providerConfig,
error || "Unknown"
);
next(error);
}
}
Expand Down Expand Up @@ -302,16 +307,20 @@ export class Controller {
}
}
} catch (error) {
// prevent logging of refresh errors
// prevent logging of integration errors that are forwarded to the client
if (
error instanceof ServerError &&
error.message === IntegrationErrorType.INTEGRATION_REFRESH_ERROR
error.message in IntegrationErrorType
) {
next(error);
return;
}

console.error("Could not delete contact:", error || "Unknown");
errorLogger(
"Could not delete contact:",
req.providerConfig,
error || "Unknown"
);
next(error);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/models/integration-error.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export enum IntegrationErrorType {
INTEGRATION_INVALID_URL = "integration/invalid-url",
INTEGRATION_REFRESH_ERROR = "integration/refresh-error",
INTEGRATION_ACCOUNT_EXPIRED_ERROR = "integration/account-expired-error",
CONTACT_CREATE_ERROR_CONFLICT = "contact/create-error/conflict",
CONTACT_CREATE_ERROR_EMAIL_CONFLICT = "contact/create-error/email-conflict",
CONTACT_ERROR_TOO_MANY_NUMBERS = "contact/error/too-many-numbers",
Expand Down