Skip to content

Commit

Permalink
Refactor error messages codes. Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
farost committed Mar 21, 2024
1 parent fa0ef06 commit 914ff51
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 507 deletions.
902 changes: 413 additions & 489 deletions .factory/automation.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ release_validate_deps(
"@vaticle_typeql",
],
tags = ["manual"], # in order for bazel test //... to not fail
version_file = "VERSION", # TODO: It is temporary while the main build fails!
version_file = ":VERSION",
)

# Force tools to be built during `build //...`
Expand Down
8 changes: 4 additions & 4 deletions cpp/lib/common/error_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace TypeDB {

namespace DriverError {

#define ERR_DRIVER(ID, MSG) ERRMSG("CCCL", "Driver Error", ID, MSG)
#define ERR_DRIVER(ID, MSG) ERRMSG("DRI", "Driver Error", ID, MSG)
DECLSPEC_DLL extern const ErrorMessage DRIVER_CLOSED = ERR_DRIVER(1, "The driver has been closed and no further operation is allowed.");
DECLSPEC_DLL extern const ErrorMessage SESSION_CLOSED = ERR_DRIVER(2, "The session has been closed and no further operation is allowed.");
DECLSPEC_DLL extern const ErrorMessage TRANSACTION_CLOSED = ERR_DRIVER(3, "The transaction has been closed and no further operation is allowed.");
Expand All @@ -48,7 +48,7 @@ DECLSPEC_DLL extern const ErrorMessage CALLBACK_EXCEPTION = ERR_DRIVER(9, "An ex

namespace ConceptError {

#define ERR_CONCEPT(ID, MSG) ERRMSG("CCO", "Concept Error", ID, MSG)
#define ERR_CONCEPT(ID, MSG) ERRMSG("CON", "Concept Error", ID, MSG)
DECLSPEC_DLL extern const ErrorMessage INVALID_CONCEPT_CASTING = ERR_CONCEPT(1, "Invalid concept conversion from '%s' to '%s'.");
DECLSPEC_DLL extern const ErrorMessage MISSING_TRANSACTION = ERR_CONCEPT(2, "Transaction cannot be null.");
DECLSPEC_DLL extern const ErrorMessage MISSING_IID = ERR_CONCEPT(3, "IID cannot be null or empty.");
Expand All @@ -64,7 +64,7 @@ DECLSPEC_DLL extern const ErrorMessage UNRECOGNISED_ANNOTATION = ERR_CONCEPT(9,

namespace QueryError {

#define ERR_QUERY(ID, MSG) ERRMSG("CQY", "Query Error", ID, MSG)
#define ERR_QUERY(ID, MSG) ERRMSG("QRY", "Query Error", ID, MSG)
DECLSPEC_DLL extern const ErrorMessage VARIABLE_DOES_NOT_EXIST = ERR_QUERY(1, "The variable '%s' does not exist.");
DECLSPEC_DLL extern const ErrorMessage MISSING_QUERY = ERR_QUERY(2, "Query cannot be null or empty.");
#undef ERR_QUERY
Expand All @@ -73,7 +73,7 @@ DECLSPEC_DLL extern const ErrorMessage MISSING_QUERY = ERR_QUERY(2, "Query canno

namespace InternalError {

#define ERR_INTERNAL(ID, MSG) ERRMSG("CIN", "C++ Internal Error", ID, MSG)
#define ERR_INTERNAL(ID, MSG) ERRMSG("INT", "C++ Internal Error", ID, MSG)
DECLSPEC_DLL extern const ErrorMessage UNEXPECTED_NATIVE_VALUE = ERR_INTERNAL(1, "Unexpected native value encountered!");
DECLSPEC_DLL extern const ErrorMessage ILLEGAL_STATE = ERR_INTERNAL(2, "Illegal state has been reached! (%s : %d).");
DECLSPEC_DLL extern const ErrorMessage ILLEGAL_CAST = ERR_INTERNAL(3, "Illegal casting operation to '%s'.");
Expand Down
8 changes: 4 additions & 4 deletions csharp/Common/Exception/ErrorMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Error
{
public class Driver : ErrorMessage
{
private const string CODE_PREFIX = "CSCL";
private const string CODE_PREFIX = "DRI";
private const string MESSAGE_PREFIX = "Driver Error";

public Driver(int codeNumber, string message)
Expand All @@ -76,7 +76,7 @@ public Driver(int codeNumber, string message)

public class Concept : ErrorMessage
{
private const string CODE_PREFIX = "CSCO";
private const string CODE_PREFIX = "CON";
private const string MESSAGE_PREFIX = "Concept Error";

public Concept(int codeNumber, string message)
Expand Down Expand Up @@ -106,7 +106,7 @@ public Concept(int codeNumber, string message)

public class Query : ErrorMessage
{
private const string CODE_PREFIX = "CSQY";
private const string CODE_PREFIX = "QRY";
private const string MESSAGE_PREFIX = "Query Error";

public Query(int codeNumber, string message)
Expand All @@ -122,7 +122,7 @@ public Query(int codeNumber, string message)

public class Internal : ErrorMessage
{
private const string CODE_PREFIX = "CSIN";
private const string CODE_PREFIX = "INT";
private const string MESSAGE_PREFIX = "C# Internal Error";

public Internal(int codeNumber, string message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ load("@vaticle_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test")

csharp_integration_test(
name = "test",
srcs = ["MemoryTest.cs"],
srcs = ["MarshalTest.cs"],
deps = [
"//csharp:driver-csharp",
"//csharp/Api:api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static void CheckAllDatabases(IDatabaseManager dbManager, ICollection<str
}

[TestFixture]
public class MemoryTestFixture
public class MarshalTestFixture
{
[Test]
public void SendArraysToNativeSide()
Expand Down
4 changes: 2 additions & 2 deletions dependencies/vaticle/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
def vaticle_dependencies():
git_repository(
name = "vaticle_dependencies",
remote = "https://github.com/farost/dependencies",
commit = "9d4c9e27474d9b48ef63cfe6f29c95c9b11395d6", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_dependencies
remote = "https://github.com/vaticle/dependencies",
commit = "7518f8adaf5714512a8af96128b15cca7dedd475", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_dependencies
)

def vaticle_typedb_common():
Expand Down
8 changes: 4 additions & 4 deletions java/common/exception/ErrorMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static class Driver extends ErrorMessage {
public static final Driver MISSING_DB_NAME =
new Driver(12, "Database name cannot be null.");

private static final String codePrefix = "JCL";
private static final String codePrefix = "DRI";
private static final String messagePrefix = "Driver Error";

Driver(int number, String message) {
Expand Down Expand Up @@ -81,7 +81,7 @@ public static class Concept extends ErrorMessage {
public static final Concept UNRECOGNISED_ANNOTATION =
new Concept(9, "The annotation '%s' is not recognised.");

private static final String codePrefix = "JCO";
private static final String codePrefix = "CON";
private static final String messagePrefix = "Concept Error";

Concept(int number, String message) {
Expand All @@ -95,7 +95,7 @@ public static class Query extends ErrorMessage {
public static final Query MISSING_QUERY =
new Query(2, "Query cannot be null or empty.");

private static final String codePrefix = "JQY";
private static final String codePrefix = "QRY";
private static final String messagePrefix = "Query Error";

Query(int number, String message) {
Expand All @@ -113,7 +113,7 @@ public static class Internal extends ErrorMessage {
public static final Internal NULL_NATIVE_VALUE =
new Internal(4, "Unhandled null pointer to a native object encountered!");

private static final String codePrefix = "JIN";
private static final String codePrefix = "INT";
private static final String messagePrefix = "Java Internal Error";

Internal(int number, String message) {
Expand Down
2 changes: 1 addition & 1 deletion python/typedb/common/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class InternalErrorMessage(ErrorMessage):
"""

def __init__(self, code: int, message: str):
super(InternalErrorMessage, self).__init__(code_prefix="PIN", code_number=code,
super(InternalErrorMessage, self).__init__(code_prefix="INT", code_number=code,
message_prefix="Python Internal Error", message_body=message)


Expand Down

0 comments on commit 914ff51

Please sign in to comment.