-
Notifications
You must be signed in to change notification settings - Fork 1
/
Errors.alusus
51 lines (45 loc) · 2.29 KB
/
Errors.alusus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@merge module Rows {
module Errors {
def DB_NOT_INITIALIZED: "rows_db_not_initialized";
def DB_NOT_INITIALIZED_MSG: "DB is not initialized.";
func dbNotInitialized(): SrdRef[GenericError] {
return GenericError.new(DB_NOT_INITIALIZED, DB_NOT_INITIALIZED_MSG);
}
def DB_NOT_CONNECTED: "rows_db_not_connected";
def DB_NOT_CONNECTED_MSG: "DB is not connected.";
func dbNotConnected(): SrdRef[GenericError] {
return GenericError.new(DB_NOT_CONNECTED, DB_NOT_CONNECTED_MSG);
}
def SQL_ERROR: "rows_sql_error";
func sqlError(errorMsg: CharsPtr): SrdRef[GenericError] {
return GenericError.new(SQL_ERROR, errorMsg);
}
def CONNECTION_MISSING: "rows_connection_missing";
def CONNECTION_MISSING_MSG: "No DB connection is set for this model.";
func connectionMissing(): SrdRef[GenericError] {
return GenericError.new(CONNECTION_MISSING, CONNECTION_MISSING_MSG);
}
def MIGRATION_MISSING: "rows_migration_missing";
def MIGRATION_MISSING_MSG: "No migration was found for migrating table %s from version %i.";
func migrationMissing(tableName: CharsPtr, version: Int): SrdRef[GenericError] {
return GenericError.new(
String(MIGRATION_MISSING),
String.format(MIGRATION_MISSING_MSG, tableName, version)
);
}
def MIGRATION_DEPENDENCY_MISSING: "rows_migration_dependency_missing";
def MIGRATION_DEPENDENCY_MISSING_MSG:
"Migration for table %s from version %i to version %i has unmet dependencies.";
func migrationDependencyMissing(tableName: CharsPtr, fromVersion: Int, toVersion: Int): SrdRef[GenericError] {
return GenericError.new(
String(MIGRATION_MISSING),
String.format(MIGRATION_DEPENDENCY_MISSING_MSG, tableName, fromVersion, toVersion)
);
}
def MIGRATION_DEPENDENCY_CYCLE: "rows_migration_dependency_cycle";
def MIGRATION_DEPENDENCY_CYCLE_MSG: "A cycle is detected in migration dependencies";
func migrationDependencyCycle(): SrdRef[GenericError] {
return GenericError.new(MIGRATION_DEPENDENCY_CYCLE, MIGRATION_DEPENDENCY_CYCLE_MSG);
}
}
}