mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
feat: Save error backtrace for sync errors for better debugging (#1578)
Co-authored-by: Tony Vincent Yesudas <tony.yesudas@raisenow.com>
This commit is contained in:
@@ -34,6 +34,11 @@ class Sync < ApplicationRecord
|
||||
scope.set_context("sync", { id: id })
|
||||
end
|
||||
|
||||
update! status: :failed, error: error.message, last_ran_at: Time.current
|
||||
update!(
|
||||
status: :failed,
|
||||
error: error.message,
|
||||
error_backtrace: error.backtrace&.first(10),
|
||||
last_ran_at: Time.current
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
5
db/migrate/20241227142333_add_error_trace_to_syncs.rb
Normal file
5
db/migrate/20241227142333_add_error_trace_to_syncs.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddErrorTraceToSyncs < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :syncs, :error_backtrace, :text, array: true
|
||||
end
|
||||
end
|
||||
3
db/schema.rb
generated
3
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_19_174803) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_27_142333) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
@@ -583,6 +583,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_19_174803) do
|
||||
t.jsonb "data"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.text "error_backtrace", array: true
|
||||
t.index ["syncable_type", "syncable_id"], name: "index_syncs_on_syncable"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user