1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02: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:
Tony Vincent 2024-12-30 16:04:05 +01:00 committed by GitHub
parent 77def1db40
commit 9d217afb9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View file

@ -34,6 +34,11 @@ class Sync < ApplicationRecord
scope.set_context("sync", { id: id }) scope.set_context("sync", { id: id })
end 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
end end

View 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
View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto" enable_extension "pgcrypto"
enable_extension "plpgsql" enable_extension "plpgsql"
@ -583,6 +583,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_19_174803) do
t.jsonb "data" t.jsonb "data"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_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" t.index ["syncable_type", "syncable_id"], name: "index_syncs_on_syncable"
end end