Exception: PgSqlTriggers::NotFoundError

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

Overview

Error raised when a trigger is not found

Examples:

raise PgSqlTriggers::NotFoundError.new(
  "Trigger 'users_email_validation' not found",
  error_code: "TRIGGER_NOT_FOUND",
  recovery_suggestion: "Verify trigger name or create the trigger first",
  context: { trigger_name: "users_email_validation" }
)

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



228
229
230
# File 'lib/pg_sql_triggers/errors.rb', line 228

def default_error_code
  "NOT_FOUND"
end

#default_messageObject



232
233
234
# File 'lib/pg_sql_triggers/errors.rb', line 232

def default_message
  "Resource not found"
end

#default_recovery_suggestionObject



236
237
238
239
240
241
242
243
# File 'lib/pg_sql_triggers/errors.rb', line 236

def default_recovery_suggestion
  if context[:trigger_name]
    "Trigger '#{context[:trigger_name]}' not found. " \
      "Verify the trigger name or create the trigger first using the generator or DSL."
  else
    "The requested resource was not found. Verify the identifier and try again."
  end
end