Skip to content

Commit b8802f3

Browse files
committed
return on error and report back the error message
1 parent df13448 commit b8802f3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/refactor.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function renamerefactor(
4949
:success => "_Local_ rename refactoring `$old` ⟹ `$new` succeeded"
5050
)
5151
catch err
52-
@error err
52+
return Dict(:error => errdescription(old, new, err))
5353
end
5454
end
5555

@@ -72,10 +72,8 @@ function renamerefactor(
7272

7373
return Dict(kind => desc)
7474
catch err
75-
@error err
75+
return Dict(:error => errdescription(old, new, err))
7676
end
77-
78-
return Dict(:error => "Rename refactoring `$old` ⟹ `$new` failed")
7977
end
8078

8179
islocalrefactor(bind, name) = bind === nothing || name bind.name
@@ -187,7 +185,7 @@ function contextdescription(old, mod, context)
187185
gotouri = urigoto(mod, old)
188186
"""
189187
`$old` isn't found in local bindings in the current context:
190-
<details><summary>Context</summary><pre><code>$(strip(context))</code></p></details>
188+
<details><summary>Context:</summary><pre><code>$(strip(context))</code></p></details>
191189
192190
If you want a global rename refactoring on `$mod.$old`, you need to run this command
193191
from its definition. <button>[Go to `$mod.$old`]($gotouri)</button>
@@ -222,3 +220,11 @@ function filedescription(mod, files)
222220
</summary><ul>$(filelist)</ul></details>
223221
"""
224222
end
223+
224+
function errdescription(old, new, err)
225+
"""
226+
Rename refactoring `$old` ⟹ `$new` failed.
227+
228+
<details><summary>Error:</summary><pre><code>$(errmsg(err))</code></p></details>
229+
"""
230+
end

0 commit comments

Comments
 (0)