Cassandra API create table error messages swallowed by the Portal and shown as "undefined". (#1790)

* changed error message variable

* changed other error messages

* Added check in case responseJSON is missing

* created error const
This commit is contained in:
JustinKol 2024-04-15 15:47:58 -04:00 committed by GitHub
parent 00a816c488
commit d35e2a325e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,8 +172,9 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(entity); deferred.resolve(entity);
}, },
(error) => { (error) => {
handleError(error, "AddRowCassandra", `Error while adding new row to table ${collection.id()}`); const errorText = error.responseJSON?.message ?? JSON.stringify(error);
deferred.reject(error); handleError(errorText, "AddRowCassandra", `Error while adding new row to table ${collection.id()}`);
deferred.reject(errorText);
}, },
) )
.finally(clearInProgressMessage); .finally(clearInProgressMessage);
@ -406,12 +407,13 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(); deferred.resolve();
}, },
(error) => { (error) => {
const errorText = error.responseJSON?.message ?? JSON.stringify(error);
handleError( handleError(
error, errorText,
"CreateKeyspaceCassandra", "CreateKeyspaceCassandra",
`Error while creating a keyspace with query ${createKeyspaceQuery}`, `Error while creating a keyspace with query ${createKeyspaceQuery}`,
); );
deferred.reject(error); deferred.reject(errorText);
}, },
) )
.finally(clearInProgressMessage); .finally(clearInProgressMessage);
@ -444,8 +446,13 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(); deferred.resolve();
}, },
(error) => { (error) => {
handleError(error, "CreateTableCassandra", `Error while creating a table with query ${createTableQuery}`); const errorText = error.responseJSON?.message ?? JSON.stringify(error);
deferred.reject(error); handleError(
errorText,
"CreateTableCassandra",
`Error while creating a table with query ${createTableQuery}`,
);
deferred.reject(errorText);
}, },
) )
.finally(clearInProgressMessage); .finally(clearInProgressMessage);
@ -493,8 +500,9 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(data); deferred.resolve(data);
}, },
(error: any) => { (error: any) => {
handleError(error, "FetchKeysCassandra", `Error fetching keys for table ${collection.id()}`); const errorText = error.responseJSON?.message ?? JSON.stringify(error);
deferred.reject(error); handleError(errorText, "FetchKeysCassandra", `Error fetching keys for table ${collection.id()}`);
deferred.reject(errorText);
}, },
) )
.done(clearInProgressMessage); .done(clearInProgressMessage);
@ -533,8 +541,9 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(data); deferred.resolve(data);
}, },
(error: any) => { (error: any) => {
handleError(error, "FetchKeysCassandra", `Error fetching keys for table ${collection.id()}`); const errorText = error.responseJSON?.message ?? JSON.stringify(error);
deferred.reject(error); handleError(errorText, "FetchKeysCassandra", `Error fetching keys for table ${collection.id()}`);
deferred.reject(errorText);
}, },
) )
.done(clearInProgressMessage); .done(clearInProgressMessage);
@ -578,8 +587,9 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(data.columns); deferred.resolve(data.columns);
}, },
(error: any) => { (error: any) => {
handleError(error, "FetchSchemaCassandra", `Error fetching schema for table ${collection.id()}`); const errorText = error.responseJSON?.message ?? JSON.stringify(error);
deferred.reject(error); handleError(errorText, "FetchSchemaCassandra", `Error fetching schema for table ${collection.id()}`);
deferred.reject(errorText);
}, },
) )
.done(clearInProgressMessage); .done(clearInProgressMessage);
@ -618,8 +628,9 @@ export class CassandraAPIDataClient extends TableDataClient {
deferred.resolve(data.columns); deferred.resolve(data.columns);
}, },
(error: any) => { (error: any) => {
handleError(error, "FetchSchemaCassandra", `Error fetching schema for table ${collection.id()}`); const errorText = error.responseJSON?.message ?? JSON.stringify(error);
deferred.reject(error); handleError(errorText, "FetchSchemaCassandra", `Error fetching schema for table ${collection.id()}`);
deferred.reject(errorText);
}, },
) )
.done(clearInProgressMessage); .done(clearInProgressMessage);