Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(commitService): add logging #1211

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
42 changes: 42 additions & 0 deletions src/services/db/GitFileCommitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,18 @@ export default class GitFileCommitService {
}

if (stagingCreateResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingCreateResult.error} when creating commit to staging for ${sessionData.siteName} for file ${fileName} in directory ${directoryName}`
)
throw stagingCreateResult.error
} else if (
shouldUpdateStagingLite &&
stagingLiteCreateResult &&
stagingLiteCreateResult.isErr()
) {
logger.error(
`CommitServiceError: ${stagingLiteCreateResult.error} when creating commit to staging-lite for ${sessionData.siteName} for file ${fileName} in directory ${directoryName}`
)
throw stagingLiteCreateResult.error
}

Expand Down Expand Up @@ -140,12 +146,18 @@ export default class GitFileCommitService {
}

if (stagingUpdateResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingUpdateResult.error} when updating in staging for ${sessionData.siteName} for file ${fileName} in directory ${directoryName}`
)
throw stagingUpdateResult.error
} else if (
shouldUpdateStagingLite &&
stagingLiteUpdateResult &&
stagingLiteUpdateResult.isErr()
) {
logger.error(
`CommitServiceError: ${stagingLiteUpdateResult.error} when updating to staging-lite for ${sessionData.siteName} for file ${fileName} in directory ${directoryName}`
)
throw stagingLiteUpdateResult.error
}

Expand Down Expand Up @@ -190,12 +202,18 @@ export default class GitFileCommitService {
}

if (stagingDeleteResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingDeleteResult.error} when deleting in staging for ${sessionData.siteName} for directory ${directoryName}`
)
throw stagingDeleteResult.error
} else if (
shouldUpdateStagingLite &&
stagingLiteDeleteResult &&
stagingLiteDeleteResult.isErr()
) {
logger.error(
`CommitServiceError: ${stagingLiteDeleteResult.error} when deleting in staging-lite for ${sessionData.siteName} for directory ${directoryName}`
)
throw stagingLiteDeleteResult.error
}

Expand Down Expand Up @@ -246,12 +264,18 @@ export default class GitFileCommitService {
}

if (stagingDeleteResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingDeleteResult.error} when deleting in staging for ${sessionData.siteName} for file ${fileName} in directory ${directoryName}`
)
throw stagingDeleteResult.error
} else if (
shouldUpdateStagingLite &&
stagingLiteDeleteResult &&
stagingLiteDeleteResult.isErr()
) {
logger.error(
`CommitServiceError: ${stagingLiteDeleteResult.error} when deleting in staging-lite for ${sessionData.siteName} for file ${fileName} in directory ${directoryName}`
)
throw stagingLiteDeleteResult.error
}

Expand Down Expand Up @@ -289,12 +313,18 @@ export default class GitFileCommitService {
}

if (stagingDeleteResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingDeleteResult.error} when deleting in staging for ${sessionData.siteName} for multiple files ${items}`
)
throw stagingDeleteResult.error
} else if (
shouldUpdateStagingLite &&
stagingLiteDeleteResult &&
stagingLiteDeleteResult.isErr()
) {
logger.error(
`CommitServiceError: ${stagingLiteDeleteResult.error} when deleting in staging-lite for ${sessionData.siteName} for multiple files ${items}`
)
throw stagingLiteDeleteResult.error
}

Expand All @@ -321,6 +351,9 @@ export default class GitFileCommitService {
)

if (stagingRenameResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingRenameResult.error} when renaming in staging for ${sessionData.siteName} for directory ${oldPath} to ${newPath}`
)
throw stagingRenameResult.error
}

Expand All @@ -338,6 +371,9 @@ export default class GitFileCommitService {
message
)
if (stagingLiteRenameResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingLiteRenameResult.error} when renaming in staging-lite for ${sessionData.siteName} for directory ${oldPath} to ${newPath}`
)
throw stagingLiteRenameResult.error
}
}
Expand Down Expand Up @@ -366,6 +402,9 @@ export default class GitFileCommitService {
message
)
if (stagingMvFilesResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingMvFilesResult.error} when moving in staging for ${sessionData.siteName} for directory ${oldPath} to ${newPath}`
)
throw stagingMvFilesResult.error
}

Expand All @@ -384,6 +423,9 @@ export default class GitFileCommitService {
message
)
if (stagingLiteMvFilesResult.isErr()) {
logger.error(
`CommitServiceError: ${stagingLiteMvFilesResult.error} when moving in staging-lite for ${sessionData.siteName} for directory ${oldPath} to ${newPath}`
)
throw stagingLiteMvFilesResult.error
}
}
Expand Down
Loading