ZyX_I committed 35a2a0e

ftplugin/aurumannotate: Added some throws. Ref #12

Comments (0)

Files changed (1)


             \                       '@/os': '0.0',})
 let s:_messages={
             \  'nofile': 'File %s was added in revision %s',
-            \ 'norfile': 'File %s is not present in the working directory',
+            \ 'norfile': 'File %s is not present in the working directory '.
+            \            'or is not readable',
+            \  'noprev': 'Can’t find any revision before %s',
+            \  'nonext': 'Can’t find any revision after %s',
+            \  'nopars': 'Revision %s has no parents',
 "▶1 getfile :: repo, cs → path
 function s:F.getfile(repo, cs)
         if a:action[:2] is# 'rev'
             let cs1=bvar.repo.functions.getcs(bvar.repo, hex)
             if empty(cs1.parents)
-                return
+                call s:_f.throw('nopars', cs1.hex)
             let rev1=cs1.parents[0]
         elseif bvar.rev isnot# bvar.repo.functions.getworkhex(bvar.repo)
                 if empty(rev1)
                     let file1=s:_r.os.path.join(bvar.repo.path, bvar.file)
                     let existed=bufexists(file1)
-                    if filereadable(file1)
-                        execute 'silent edit' fnameescape(file1)
-                    else
+                    if !filereadable(file1)
                         call s:_f.throw('norfile', file1)
+                    execute 'silent edit' fnameescape(file1)
-                    try
-                        let'silent edit', 'file', bvar.repo,
-                                    \        rev1, file)
-                    catch /\V\^Frawor:\[^:]\+:nofile:/
-                        call s:_f.throw('nofile', file, rev1)
-                    endtry
+                    let'silent edit', 'file', bvar.repo, rev1,
+                                \                               file)
                 if existed
                     setlocal bufhidden=wipe
         let c=((a:action is# 'previous')?(v:count1):(-v:count1))
         let rev=bvar.repo.functions.getnthparent(bvar.repo, bvar.rev, c).hex
         if rev is# hex
-            return
+            call s:_f.throw('no'.a:action[:3], hex)
         call'silent edit', 'annotate', bvar.repo, rev, bvar.file)
         setlocal scrollbind