-
Notifications
You must be signed in to change notification settings - Fork 40
Split schema-loader errors and data-loader errors from CoreError #2805
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
Split schema-loader errors and data-loader errors from CoreError #2805
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extracts schema-loader and data-loader errors from CoreError into their own enums (SchemaLoaderError, DataLoaderError) and updates all references accordingly.
- Introduced
SchemaLoaderErrorenum and replacedCoreErrorusage in schema-loader module - Introduced
DataLoaderErrorenum and updated tests and code in data-loader and CLI modules to use it - Added uniqueness tests for both error enums
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoaderError.java | New enum for schema-loader error codes |
| schema-loader/src/main/java/com/scalar/db/schemaloader/command/SchemaLoaderCommand.java | Replaced CoreError with SchemaLoaderError in CLI commands |
| schema-loader/src/main/java/com/scalar/db/schemaloader/alteration/TableMetadataAlterationProcessor.java | Updated error references to use SchemaLoaderError |
| schema-loader/src/main/java/com/scalar/db/schemaloader/TableSchema.java | Swapped CoreError for SchemaLoaderError in parsing logic |
| schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaOperator.java | Updated table-not-found error to SchemaLoaderError |
| schema-loader/src/test/java/com/scalar/db/schemaloader/SchemaLoaderErrorTest.java | Added duplicate-code check for SchemaLoaderError |
| data-loader/core/src/main/java/com/scalar/db/dataloader/core/DataLoaderError.java | New enum for data-loader error codes |
| data-loader/core/src/main/java/com/scalar/db/dataloader/core/util/*.java | Replaced CoreError with DataLoaderError in utility classes |
| data-loader/core/src/test/java/com/scalar/db/dataloader/core/*.java | Updated tests to use DataLoaderError |
| data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/util/*.java | Replaced CoreError with DataLoaderError in CLI utils |
| data-loader/cli/src/test/java/com/scalar/db/dataloader/cli/util/*.java | Updated CLI tests to use DataLoaderError |
Comments suppressed due to low confidence (2)
schema-loader/src/main/java/com/scalar/db/schemaloader/command/SchemaLoaderCommand.java:144
- Consider throwing
SchemaLoaderException(or wrapping theIllegalArgumentException) here instead of a rawIllegalArgumentException, to align with the method signature and centralize error handling.
throw new IllegalArgumentException(
schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoaderError.java:1
- [nitpick] You may want to add class-level Javadoc to
SchemaLoaderErrorexplaining its purpose and how error codes map to user scenarios.
package com.scalar.db.schemaloader;
| SPECIFYING_SCHEMA_FILE_REQUIRED_WHEN_USING_ALTER( | ||
| Category.USER_ERROR, | ||
| "0007", | ||
| "Specifying the '--schema-file' option is required when using the '--alter' option", |
Copilot
AI
Jun 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] For consistency with other messages, consider adding a trailing period to this error message.
| "Specifying the '--schema-file' option is required when using the '--alter' option", | |
| "Specifying the '--schema-file' option is required when using the '--alter' option.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd that Copilot suggests the period only here. If we apply the period here, we should apply it consistently to all other messages. However, I believe it was decided that we wouldn't add periods to messages that contained only one sentence.
f2400a0 to
9902070
Compare
| import com.scalar.db.common.error.Category; | ||
| import com.scalar.db.common.error.ScalarDbError; | ||
|
|
||
| public enum DataLoaderError implements ScalarDbError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josh-wong IIRC, you haven’t checked the error messages in data-loader yet. If that’s correct, could you please take a look? 🙇
| Category.INTERNAL_ERROR, "0006", "Failed to read JSON Lines file. Details: %s", "", ""), | ||
| ; | ||
|
|
||
| private static final String COMPONENT_NAME = "DB-DATA-LOADER"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feeblefakie The prefix of the error code for data-loader is DB-DATA-LOADER. Is that okay?
| Category.USER_ERROR, "0017", "Invalid column type. Table: %s; Column: %s; Type: %s", "", ""), | ||
| ; | ||
|
|
||
| private static final String COMPONENT_NAME = "DB-SCHEMA-LOADER"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feeblefakie The prefix of the error code for schema-loader is DB-SCHEMA-LOADER. Is that okay?
komamitsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
feeblefakie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
ypeckstadt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
inv-jishnu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you!
thongdk8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
josh-wong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comments and suggestions. PTAL!
data-loader/core/src/main/java/com/scalar/db/dataloader/core/DataLoaderError.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/DataLoaderError.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/DataLoaderError.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/DataLoaderError.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/DataLoaderError.java
Outdated
Show resolved
Hide resolved
schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoaderError.java
Outdated
Show resolved
Hide resolved
schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoaderError.java
Outdated
Show resolved
Hide resolved
schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoaderError.java
Outdated
Show resolved
Hide resolved
schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoaderError.java
Outdated
Show resolved
Hide resolved
| SPECIFYING_SCHEMA_FILE_REQUIRED_WHEN_USING_ALTER( | ||
| Category.USER_ERROR, | ||
| "0007", | ||
| "Specifying the '--schema-file' option is required when using the '--alter' option", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd that Copilot suggests the period only here. If we apply the period here, we should apply it consistently to all other messages. However, I believe it was decided that we wouldn't add periods to messages that contained only one sentence.
Torch3333
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Co-authored-by: Josh Wong <[email protected]>
Co-authored-by: Josh Wong <[email protected]>
|
@josh-wong I've just applied your suggestions. Could you please dobule-check? 🙇 |
josh-wong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!🙇🏻♂️
…errors-from-CoreError
Co-authored-by: Josh Wong <[email protected]>
Description
This PR splits the schema-loader errors and the data-loader errors from
CoreError.Related issues and/or PRs
N/A
Changes made
SchemaLoderError, and moved the schema-loader related errors to it fromCoreError.DataLoderError, and moved the data-loader related errors to itCoreError.CoreErrorto the packagecom.scalar.db.common.Checklist
Additional notes (optional)
N/A
Release notes
N/A