Exception: PgSqlTriggers::ValidationError

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

Overview

Error raised when validation fails

Examples:

raise PgSqlTriggers::ValidationError.new(
  "Invalid trigger definition: table name is required",
  error_code: "VALIDATION_FAILED",
  recovery_suggestion: "Ensure all required fields are provided in the trigger definition",
  context: { field: :table_name, errors: ["is required"] }
)

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



148
149
150
# File 'lib/pg_sql_triggers/errors.rb', line 148

def default_error_code
  "VALIDATION_FAILED"
end

#default_messageObject



152
153
154
# File 'lib/pg_sql_triggers/errors.rb', line 152

def default_message
  "Validation failed"
end

#default_recovery_suggestionObject



156
157
158
159
160
161
162
# File 'lib/pg_sql_triggers/errors.rb', line 156

def default_recovery_suggestion
  if context[:field]
    "Please fix the #{context[:field]} field and try again."
  else
    "Please review the input and ensure all required fields are provided."
  end
end