Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Give more info about Cassandra exception when they occurs

  • Loading branch information...
commit 44d1e76afc1832d2461f2db5de364f798840fcdc 1 parent 325a3c2
@sebgiroux sebgiroux authored
Showing with 44 additions and 3 deletions.
  1. +3 −2 columnfamily_action.php
  2. +41 −1 include/kernel.inc.php
View
5 columnfamily_action.php
@@ -703,6 +703,9 @@
$vw_row_vars['is_super_cf'] = $cf_def->column_type == 'Super';
$vw_row_vars['is_counter_column'] = $column_family->cfdef->default_validation_class == 'org.apache.cassandra.db.marshal.CounterColumnType';
+
+ $included_header = true;
+ echo getHTML('header.php');
$result = $column_family->get_range($offset_key,'',$nb_rows);
@@ -742,8 +745,6 @@
$vw_vars['is_counter_column'] = $vw_row_vars['is_counter_column'];
- $included_header = true;
- echo getHTML('header.php');
echo getHTML('columnfamily_browse_data.php',$vw_vars);
}
catch (cassandra_NotFoundException $e) {
View
42 include/kernel.inc.php
@@ -114,7 +114,13 @@ function displayInfoMessage($index,$params = array()) {
function displayErrorMessage($index,$params = array()) {
global $lang;
- return '<div class="error_message">'.nl2br(getLang('form_error_'.$index,$params)).'</div>';
+ $message = nl2br(getLang('form_error_'.$index,$params));
+
+ if ($index == 'something_wrong_happened' && isset($params['message'])) {
+ $message .= ' '.getCassandraMessage($params['message']);
+ }
+
+ return '<div class="error_message">'.$message.'</div>';
}
$current_page_title = 'Cassandra Cluster Admin';
@@ -148,4 +154,38 @@ function getQueryTime($time_start,$time_end) {
function displayOneCfDef($key) {
return ucwords(str_replace('_',' ',$key));
}
+
+ function getCassandraMessage($exception_message) {
+ preg_match('/The last error was (.*):/',$exception_message,$matches);
+
+ if (isset($matches[1])) {
+ switch ($matches[1]) {
+ case 'cassandra_NotFoundException':
+ return 'A specific column was requested that does not exist.';
+
+ case 'cassandra_InvalidRequestException':
+ return 'Invalid request could mean keyspace or column family does not exist, required parameters are missing, or a parameter is malformed. why contains an associated error message.';
+
+ case 'cassandra_UnavailableException':
+ return 'Not all the replicas required could be created and/or read.';
+
+ case 'cassandra_TimedOutException':
+ return 'The node responsible for the write or read did not respond during the rpc interval specified in your configuration (default 10s). This can happen if the request is too large, the node is oversaturated with requests, or the node is down but the failure detector has not yet realized it (usually this takes < 30s).';
+
+ case 'cassandra_TApplicationException':
+ return 'Internal server error or invalid Thrift method (possible if you are using an older version of a Thrift client with a newer build of the Cassandra server).';
+
+ case 'cassandra_AuthenticationException':
+ return 'Invalid authentication request (user does not exist or credentials invalid)';
+
+ case 'cassandra_AuthorizationException':
+ return 'Invalid authorization request (user does not have access to keyspace)';
+
+ case 'cassandra_SchemaDisagreementException':
+ return 'Schemas are not in agreement across all nodes';
+ }
+
+ return '';
+ }
+ }
?>
Please sign in to comment.
Something went wrong with that request. Please try again.