Skip to content

Commit

Permalink
Remove exception=get_backtrace(...) pattern (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi authored Jan 30, 2024
1 parent e41f732 commit 840fd69
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/commentbot/CommentBot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ function action(rp::RequestParams{T}, zsock::RequestSocket) where T <: RegisterT
set_error_status(rp)
end
catch ex
bt = get_backtrace(ex)
@info("Unexpected error: $bt")
@info "Unexpected error" exception = (ex, catch_backtrace())
bt = sprint(Base.showerror, ex, catch_backtrace())
raise_issue(rp.evt, rp.phrase, bt)
end
@info("Done processing register event", reponame=rp.reponame, target_registry_name)
Expand Down
6 changes: 3 additions & 3 deletions src/commentbot/approval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function get_metadata_from_pr_body(rp::RequestParams, auth)
meta = String(decrypt(MbedTLS.CIPHER_AES_128_CBC, key, hex2bytes(enc_meta), key))
return JSON.parse(meta)
catch ex
@debug("Exception occured while parsing PR body", get_backtrace(ex))
@debug "Exception occured while parsing PR body" exception = (ex, catch_backtrace())
end

nothing
Expand Down Expand Up @@ -140,8 +140,8 @@ function action(rp::RequestParams{ApprovalTrigger}, zsock)
make_comment(rp.evt, "Error in approval process: $err")
end
catch ex
bt = get_backtrace(ex)
@info("Unexpected error: $bt")
@info "Unexpected error" exception = (ex, catch_backtrace())
bt = sprint(Base.showerror, ex, catch_backtrace())
raise_issue(rp.evt, rp.phrase, bt)
end
@info("Done processing approval event", reponame=rp.reponame, rp.trigger_src.prid)
Expand Down
4 changes: 1 addition & 3 deletions src/management.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
get_backtrace(ex) = sprint(Base.showerror, ex, catch_backtrace())

function get_log_level(l)
log_level_str = lowercase(l)

Expand Down Expand Up @@ -64,7 +62,7 @@ function recover(
@warn("Stopping", name)
return
else # exception_action == :continue
@error("Recovering from unknown exception", name, backoff, exception=get_backtrace(ex))
@error "Recovering from unknown exception" name backoff exception = (ex, catch_backtrace())
sleep(backoff)
backoff = min(backoffmax, backoff+backoffincrement)
end
Expand Down
2 changes: 1 addition & 1 deletion src/webui/gitutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function gettreesha(
readchomp(`git -C $dest rev-parse $ref:$subdir`), ""
end
catch ex
@error("Exception while getting tree SHA", exception=get_backtrace(ex))
@error "Exception while getting tree SHA" exception=(ex, catch_backtrace())
nothing, "Exception while getting tree SHA"
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/webui/routes/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function register(r::HTTP.Request)
project = try
RegistryTools.Project(TOML.parse(IOBuffer(toml)))
catch e
@error "Reading project from (Julia)Project.toml failed" exception=get_backtrace(e)
@error "Reading project from (Julia)Project.toml failed" exception=(e, catch_backtrace())
return json(400; error="(Julia)Project.toml is invalid")
end
for k in [:name, :uuid, :version]
Expand Down

2 comments on commit 840fd69

@nkottary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/99816

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.9.2 -m "<description of version>" 840fd696f65c75af4e4c2cf22e666678dfb5b262
git push origin v1.9.2

Please sign in to comment.