Exception: PgSqlTriggers::ExecutionError

Inherits:
Error
  • Object
show all
Defined in:
lib/pg_sql_triggers/errors.rb

Overview

Error raised when SQL execution fails

Examples:

raise PgSqlTriggers::ExecutionError.new(
  "SQL execution failed: syntax error near 'INVALID'",
  error_code: "EXECUTION_FAILED",
  recovery_suggestion: "Review SQL syntax and ensure all references are valid",
  context: { sql: "SELECT * FROM...", database_error: "..." }
)

Instance Attribute Summary

Attributes inherited from Error

#context, #error_code, #recovery_suggestion

Instance Method Summary collapse

Methods inherited from Error

#initialize, #to_h, #user_message

Constructor Details

This class inherits a constructor from PgSqlTriggers::Error

Instance Method Details

#default_error_codeObject



175
176
177
# File 'lib/pg_sql_triggers/errors.rb', line 175

def default_error_code
  "EXECUTION_FAILED"
end

#default_messageObject



179
180
181
# File 'lib/pg_sql_triggers/errors.rb', line 179

def default_message
  "SQL execution failed"
end

#default_recovery_suggestionObject



183
184
185
186
187
188
189
# File 'lib/pg_sql_triggers/errors.rb', line 183

def default_recovery_suggestion
  if context[:database_error]
    "Review the SQL syntax and database error. Ensure all table and column names are correct."
  else
    "Review the SQL and ensure it is valid PostgreSQL syntax."
  end
end