Skip to content

Commit

Permalink
More helpful error message?
Browse files Browse the repository at this point in the history
  • Loading branch information
David Jarvis committed Feb 2, 2016
1 parent 3ebfe3c commit 9eb244b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugin/cljfmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function! s:GetFormattedFile()
silent! call fireplace#session_eval(s:GetReformatString(l:bufcontents))
catch /^Clojure:.*/
redir END
return s:GetReformatString()
throw "fmterr"
catch
redir END
throw v:exception
Expand All @@ -73,8 +73,12 @@ function! cljfmt#Format()
" save cursor position and many other things
let l:curw = winsaveview()

let formatted_output = s:GetFormattedFile()
:0,substitute/\_.*/\=formatted_output/g
try
let formatted_output = s:GetFormattedFile()
:0,substitute/\_.*/\=formatted_output/g
catch "fmterr"
echoerr "Cljfmt: Failed to format file, likely due to a syntax error."
endtry

" restore our cursor/windows positions
call winrestview(l:curw)
Expand Down

0 comments on commit 9eb244b

Please sign in to comment.