From 699dff447f0fc9bb0fc73017887bc804e79d1172 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 6 Mar 2013 17:15:57 -0500 Subject: [PATCH] Better representation of require errors Should help with #56. --- plugin/foreplay.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/foreplay.vim b/plugin/foreplay.vim index c1de88c..1abd2fe 100644 --- a/plugin/foreplay.vim +++ b/plugin/foreplay.vim @@ -146,6 +146,9 @@ function! s:repl.require(lib) dict abort let self.requires[a:lib] = 0 let result = self.eval('(doto '.s:qsym(a:lib).' (require'.reload.') the-ns)', {'ns': 'user', 'session': 0}) let self.requires[a:lib] = !has_key(result, 'ex') + if has_key(result, 'ex') + return result.err + endif endif return '' endfunction @@ -433,7 +436,13 @@ function! s:eval(expr, ...) abort let client = get(options, 'client', s:client()) if !has_key(options, 'ns') if foreplay#ns() !~# '^\%(user\)$' - call client.require(foreplay#ns()) + let error = client.require(foreplay#ns()) + if !empty(error) + echohl ErrorMSG + echo error + echohl NONE + throw "Clojure: couldn't require " . foreplay#ns() + endif endif let options.ns = foreplay#ns() endif