Skip to content

Commit

Permalink
feat: Save error backtrace for sync errors for better debugging (#1578)
Browse files Browse the repository at this point in the history
Co-authored-by: Tony Vincent Yesudas <[email protected]>
  • Loading branch information
tonyvince and Tony Vincent Yesudas authored Dec 30, 2024
1 parent 77def1d commit 9d217af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/models/sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def fail!(error)
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 changes: 5 additions & 0 deletions db/migrate/20241227142333_add_error_trace_to_syncs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddErrorTraceToSyncs < ActiveRecord::Migration[7.2]
def change
add_column :syncs, :error_backtrace, :text, array: true
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d217af

Please sign in to comment.